-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement contructable support for opennebula inventory plugin: keyed… #4524
Implement contructable support for opennebula inventory plugin: keyed… #4524
Conversation
…_groups, compose, groups
This comment was marked as outdated.
This comment was marked as outdated.
and that doesn't set |
This comment was marked as outdated.
This comment was marked as outdated.
I noticed a few things while developing this. Tags/Attributes in opennebula are forced to upper case. Meaning if you use some other process to create them (Terraform, or the webui), create them as lower case, then do not check what they actually are now, they will be upper case. Labels, on the other hand are case-preserving. Also the variables we create and add to inventory as host variables are not forced uppercase. Not sure if it's worth noting that in the plugin docs, now that you can use them there. I'm new to open nebula, so I'm not sure what the surprise factor would be here. I was surprised to see Ansible still supporting Python 2.x, let alone python 2.6. It should probably be noted that this module is unlikely to work on 2.6 - the underlying PyONE library doesn't support it. Again, dunno if it's appropriate to note that in the docs somewhere or not. @feldsam do you want me to refactor the older test data into a file in the fixtures folder? You kept it as python, but the OrderedDict is the only non-json-able bit, and it doesn't seem super important here. Then all the data would be in one place, and the test code would be shorter/clearer. |
changelogs/fragments/4524-update-opennebula-inventory-plugin-to-match-documentation.yaml
Outdated
Show resolved
Hide resolved
…o-match-documentation.yaml Co-authored-by: Felix Fontein <[email protected]>
Thought I'd drop in some before and after output. Here's a plugin config file:
After changes
|
@feldsam does this look good to you? |
Hello, thank you for contribution! |
Backport to stable-4: 💚 backport PR created✅ Backport PR branch: Backported as #4549 🤖 @patchback |
#4524) * Implement contructable support for opennebula inventory plugin: keyed_groups, compose, groups * Fixed templating mock issues in unit tests, corrected some linting errors * trying to make the linter happy * Now trying to make python2.7 happy * Added changelog fragment * changelog fragment needs pluralization * Update changelogs/fragments/4524-update-opennebula-inventory-plugin-to-match-documentation.yaml Co-authored-by: Felix Fontein <[email protected]> Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 8e72e98)
#4524) (#4549) * Implement contructable support for opennebula inventory plugin: keyed_groups, compose, groups * Fixed templating mock issues in unit tests, corrected some linting errors * trying to make the linter happy * Now trying to make python2.7 happy * Added changelog fragment * changelog fragment needs pluralization * Update changelogs/fragments/4524-update-opennebula-inventory-plugin-to-match-documentation.yaml Co-authored-by: Felix Fontein <[email protected]> Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 8e72e98) Co-authored-by: Bill Sanders <[email protected]>
…_groups, compose, groups
SUMMARY
#4497 noted that the opennebula inventory plugin inherits
Constructable
, and the doc string also includes the macro(?) for that, however the code does not implement the standard dynamic inventory features such as keyed_groups, etc. This PR aims to implement that functionality.I have included a new unit test, as well as new test-fixture data and re-worked some of the helper logic in the tests. Hopefully @feldsam is ok with the changes. I would be happy to refactor the pre-existing test and move the pre-existing sample data to the external file to make it match what I did.
Note, the PR is incomplete as not all of the testing logic passes, see below.
Fixes #4497
ISSUE TYPE
COMPONENT NAME
opennebula inventory plugin
ADDITIONAL INFORMATION
The code currently produces the output I would expect, however the unit test I added fails due to a traceback. I looked briefly into this, but wasn't quite sure why it was failing. The two
test_
functions I added are identical except that one of them has commented out portions that are currently failing here: