Icinga / terraform-provider-icinga2

Terraform Icinga2 provider
https://www.terraform.io/docs/providers/icinga2/
Mozilla Public License 2.0
21 stars 20 forks source link

Added support for vars in services. #13

Closed rayterrill closed 6 years ago

rayterrill commented 6 years ago

PR for #12

I'm a n00b to Go so I'm not sure specifically how the vendor'd github.com/lrsmith/go-icinga2-api library should be handled.

lrsmith commented 6 years ago

@rayterrill The file https://github.com/terraform-providers/terraform-provider-icinga2/blob/master/vendor/vendor.json#L520 specifies the Github checksums or tag for 'lrsmith/go-icinga2-api' . Currently it is set to 7b46d425cc71344e4357bf0bcc873e93723d1dc7 Variables were add in 0.2.0 version. If you update vendor.json to specify the 0.2.0 or later version of go-icinga2-api you should have the version with var support.

rayterrill commented 6 years ago

I'm not sure what to update it to. :( Sorry @lrsmith I am n00b status on Go and especially on the vendoring of packages.

rayterrill commented 6 years ago

@lrsmith I gave it a shot.

lrsmith commented 6 years ago

@rayterrill I checked out your initial commit and then updated lrmsith/go-icinga2-api with the following command govendor fetch github.com/lrsmith/go-icinga2-api/iapi@7c67134efd12e55cd607d9cb159fa71267e3dda8 This fetches the commit 7c67 ( the latest ) and installs it. I had to make a change to icinga2/resource_icinga2_service_test.go that I'm looking into. But it is failing the acceptance test now. I'm not sure if its my setup or not.

lrsmith commented 6 years ago

@rayterrill As I am digging into this I'm running into issues where the latest versions of go-icinga2-api has new features which have not been merged into the Terraform provider yet. I'm continuing to look at it and reached out to Hashicorp about getting some of the changes merged in. Check back with me at the end of the week, if I haven't posted any updates.

lrsmith commented 6 years ago

@rayterrill Still waiting to hear back from Hashicorp. Once the other PRs are checked in I think this should work fine.

rayterrill commented 6 years ago

@lrsmith Any more word on this? Still would love to have this.

lrsmith commented 6 years ago

@rayterrill I am working my way through the back log and hope to look at this next week and then see about getting a new release cut. Could you rebase to pull in the updated vendor/vendor.json from a PR I merged in earlier this week?

rayterrill commented 6 years ago

@lrsmith I gave it a shot! First time I've ever tried a rebase. :)

lrsmith commented 6 years ago

@rayterrill thank you. It looks like the automated tests are still failing. I'll take a look in the next couple of days. thank you again.

lrsmith commented 6 years ago

@rayterrill Wanted to follow up and let you know this is still on my radar for this week. Thanks

rayterrill commented 6 years ago

Sorry mate. I gave it a crack, and think I rebased successfully again, and made the changes as requested, but it's still failing. N00b status over here. :(

rayterrill commented 6 years ago

I gave it another crack and did the govendor update process, so govendor status passes for me locally, but it doesn’t look like it’s passing in CI. I’m not sure how to fix that. Sorry mate.

lrsmith commented 6 years ago

@rayterrill I looked at it and it is related to changes to the go-icinga2-api dependency library. The needed support for variables is not in version v0.3.0. It looks like when I had made a release with that version it failed and I backed it out. I made a new release with that version and for some reason its failing now ( https://travis-ci.org/lrsmith/go-icinga2-api ) and I need to look into that. Please standby and I'll let you know once I've resolved it there.

Thanks

rayterrill commented 6 years ago

Thanks @lrsmith. Sorry for all the back-and-forth. I'm just starting to learn Go so I'm definitely struggling with the dependencies piece (if you have any books/learning stuff you'd recommend I'm all ears!).

lrsmith commented 6 years ago

@rayterrill I'm still working on this. The code looks fine, it appears to be with the underlying setup of the tests.

rayterrill commented 6 years ago

Thanks for the update! Excited to see this shake out! :)

rayterrill commented 6 years ago

Wanted to check back in on this, @lrsmith. Anything I can help with?

lrsmith commented 6 years ago

@rayterrill Sorry this is taking longer. I'm working through some timing issues with docker and the test framework.

lrsmith commented 6 years ago

@rayterrill The underlying API and tests are working now. I'll pull down this PR and test tomorrow with the new release of the go-icinga2-api.

rayterrill commented 6 years ago

I am seriously very very excited. :)

lrsmith commented 6 years ago

@rayterrill Can you modify your PR to use the latest go-icinga2-api release. I tested this PR against 0.4.1 and the test passed. You should just need to do a 'govendor fetch github.com/lrsmith/go-icinga2-api/iapi@0.4.1' and commit the changes.

rayterrill commented 6 years ago

Sorry @lrsmith I just pushed another change that hopefully will make that build green (fingers crossed). Had to rebuild my go box and I cloned the repo down to the wrong directory path.

rayterrill commented 6 years ago

😭

lrsmith commented 6 years ago

@rayterrill looking at the errors. I copied your repo and I was able to get 'make vendor-status' pass by doing a govendor sync Could you try that and paste what 'go status' shows? That should update the vendor directory.

rayterrill commented 6 years ago

I did a govendor sync, and it looks like it picked up a bunch of changes, but when I stage them for commit, they just disappeear.

PS C:\Users\terrir\go\src\github.com\terraform-providers\terraform-provider-icinga2> C:\Users\terrir\go\bin\govendor.exe sync
PS C:\Users\terrir\go\src\github.com\terraform-providers\terraform-provider-icinga2> git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   vendor/golang.org/x/crypto/LICENSE
        modified:   vendor/golang.org/x/crypto/PATENTS
        modified:   vendor/golang.org/x/crypto/bcrypt/base64.go
        modified:   vendor/golang.org/x/crypto/bcrypt/bcrypt.go
        modified:   vendor/golang.org/x/crypto/blowfish/block.go
        modified:   vendor/golang.org/x/crypto/blowfish/cipher.go
        modified:   vendor/golang.org/x/crypto/blowfish/const.go
        modified:   vendor/golang.org/x/crypto/cast5/cast5.go
        modified:   vendor/golang.org/x/crypto/openpgp/armor/armor.go
        modified:   vendor/golang.org/x/crypto/openpgp/armor/encode.go
        modified:   vendor/golang.org/x/crypto/openpgp/canonical_text.go
        modified:   vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go
        modified:   vendor/golang.org/x/crypto/openpgp/errors/errors.go
        modified:   vendor/golang.org/x/crypto/openpgp/keys.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/compressed.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/config.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/literal.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/ocfb.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/opaque.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/packet.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/private_key.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/public_key.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/reader.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/signature.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/userattribute.go
        modified:   vendor/golang.org/x/crypto/openpgp/packet/userid.go
        modified:   vendor/golang.org/x/crypto/openpgp/read.go
        modified:   vendor/golang.org/x/crypto/openpgp/s2k/s2k.go
        modified:   vendor/golang.org/x/crypto/openpgp/write.go
        modified:   vendor/golang.org/x/net/LICENSE
        modified:   vendor/golang.org/x/net/PATENTS
        modified:   vendor/golang.org/x/net/html/atom/atom.go
        modified:   vendor/golang.org/x/net/html/atom/table.go
        modified:   vendor/golang.org/x/net/html/const.go
        modified:   vendor/golang.org/x/net/html/doc.go
        modified:   vendor/golang.org/x/net/html/doctype.go
        modified:   vendor/golang.org/x/net/html/entity.go
        modified:   vendor/golang.org/x/net/html/escape.go
        modified:   vendor/golang.org/x/net/html/foreign.go
        modified:   vendor/golang.org/x/net/html/node.go
        modified:   vendor/golang.org/x/net/html/parse.go
        modified:   vendor/golang.org/x/net/html/render.go
        modified:   vendor/golang.org/x/net/html/token.go
        modified:   vendor/vendor.json

no changes added to commit (use "git add" and/or "git commit -a")
PS C:\Users\terrir\go\src\github.com\terraform-providers\terraform-provider-icinga2> git add .
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/LICENSE.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/PATENTS.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/bcrypt/base64.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/bcrypt/bcrypt.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/blowfish/block.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/blowfish/cipher.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/blowfish/const.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/cast5/cast5.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/armor/armor.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/armor/encode.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/canonical_text.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/errors/errors.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/keys.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/compressed.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/config.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/literal.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/ocfb.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/opaque.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/packet.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/private_key.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/public_key.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/reader.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/signature.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/userattribute.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/packet/userid.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/read.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/s2k/s2k.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/crypto/openpgp/write.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/LICENSE.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/PATENTS.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/atom/atom.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/atom/table.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/const.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/doc.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/doctype.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/entity.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/escape.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/foreign.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/node.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/parse.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/render.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/golang.org/x/net/html/token.go.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in vendor/vendor.json.
The file will have its original line endings in your working directory.
PS C:\Users\terrir\go\src\github.com\terraform-providers\terraform-provider-icinga2> git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Push doesn't so anything because it doesn't see any changes. :(

lrsmith commented 6 years ago

@rayterrill I branched off your PR and created https://github.com/terraform-providers/terraform-provider-icinga2/pull/17. It has all your commits ( and identifies you are the author ) and some commits I made removing and reinstalling the vendor dependencies. That seemed to due to trick. At this point we can work and see about making those changes on your PR, or we can close your original one without merging and merge in PR 17 with your commits. Let me know what you preference is. Thanks

rayterrill commented 6 years ago

@lrsmith I would say let’s just go with yours and kill mine. No worries on that side. I’m stoked to check this out!

lrsmith commented 6 years ago

Closing. Refactored and new PR created. https://github.com/terraform-providers/terraform-provider-icinga2/pull/17.