opennebula inventory: add VM ID and VM host to data#8532
opennebula inventory: add VM ID and VM host to data#8532felixfontein merged 16 commits intoansible-collections:mainfrom
Conversation
##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
<!--- Please do not forget to include a changelog fragment:
https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
Read about more details in CONTRIBUTING.md.
-->
##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request
##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py
##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->
<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
"host": "foo23.host",
"id": 1234,
```
|
Not sure why the tests are failing as I'm not adding a new import for the pyone library...? |
|
Hi, problem is, that you added new method which is calling pyone package. To pass test, you need to also update tests to reflect this. Anyway, for such infromation - host on which is VM running, there is easier method to get this. It is already in VM object, in history records, you just need to get last history record of VM to get host. So no need to do aditional api call and searching for host. |
|
@feldsam updated PR to reflect the new information you provided. It's a very simple PR now! I'm afraid I don't understand how to fix the tests. |
Co-authored-by: Felix Fontein <felix@fontein.de>
This comment was marked as outdated.
This comment was marked as outdated.
|
Made a mess of that rebase 🤦 I should learn more before trying this again. |
haha, same thing happened to me before :) |
|
there was still a merge commit hanging, now it should be fine |
|
Thank you @abakanovskii 🙌 Appreciate your time and skilled help with this. |
|
Looks good to me as far as I can judge this. If nobody objects, I'll merge this on the weekend. |
russoz
left a comment
There was a problem hiding this comment.
LGTM (as far as I can tell - not familiar with OpenNebula)
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #9003 🤖 @patchback |
* Add VM id and VM host to opennebula inventory data
##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
<!--- Please do not forget to include a changelog fragment:
https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
Read about more details in CONTRIBUTING.md.
-->
##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request
##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py
##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->
<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
"host": "foo23.host",
"id": 1234,
```
* Create 8532-expand-opennuebula-inventory-data.yml
* Update opennebula.py
* Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add check for empty records and add test
* fix attribute test
* fix attribute test
* fix attribute test
* fix attribute test
* Update plugins/inventory/opennebula.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* update as per guidance
* restore attribute checks
* fix attr
* fix indent
* PR Fixes
* add attribute check in case of empty variable
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Александр Бакановский <abakanovskii@astralinux.ru>
(cherry picked from commit 24b74cc)
|
@aioue @abakanovskii thanks for your contribution! |
…D and VM host to data (#9003) opennebula inventory: add VM ID and VM host to data (#8532) * Add VM id and VM host to opennebula inventory data ##### SUMMARY <!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> <!--- Please do not forget to include a changelog fragment: https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments No need to include one for docs-only or test-only PR, and for new plugin/module PRs. Read about more details in CONTRIBUTING.md. --> ##### ISSUE TYPE <!--- Pick one or more below and delete the rest. 'Test Pull Request' is for PRs that add/extend tests without code changes. --> - Feature Pull Request ##### COMPONENT NAME <!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py ##### ADDITIONAL INFORMATION <!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue --> <!--- Paste verbatim command output below, e.g. before and after your change --> ```paste below "host": "foo23.host", "id": 1234, ``` * Create 8532-expand-opennuebula-inventory-data.yml * Update opennebula.py * Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Add check for empty records and add test * fix attribute test * fix attribute test * fix attribute test * fix attribute test * Update plugins/inventory/opennebula.py Co-authored-by: Felix Fontein <felix@fontein.de> * update as per guidance * restore attribute checks * fix attr * fix indent * PR Fixes * add attribute check in case of empty variable --------- Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Александр Бакановский <abakanovskii@astralinux.ru> (cherry picked from commit 24b74cc) Co-authored-by: Tom Paine <github@aioue.net>
|
@felixfontein possibly silly question, but should the commit message leak email addresses like that? |
|
@aioue that's how GitHub works, if you don't tell it to hide your email address in commit messages. (https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line) (I'm not sure whether the |
…ons#8532) * Add VM id and VM host to opennebula inventory data ##### SUMMARY <!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> <!--- Please do not forget to include a changelog fragment: https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments No need to include one for docs-only or test-only PR, and for new plugin/module PRs. Read about more details in CONTRIBUTING.md. --> ##### ISSUE TYPE <!--- Pick one or more below and delete the rest. 'Test Pull Request' is for PRs that add/extend tests without code changes. --> - Feature Pull Request ##### COMPONENT NAME <!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py ##### ADDITIONAL INFORMATION <!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue --> <!--- Paste verbatim command output below, e.g. before and after your change --> ```paste below "host": "foo23.host", "id": 1234, ``` * Create 8532-expand-opennuebula-inventory-data.yml * Update opennebula.py * Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Add check for empty records and add test * fix attribute test * fix attribute test * fix attribute test * fix attribute test * Update plugins/inventory/opennebula.py Co-authored-by: Felix Fontein <felix@fontein.de> * update as per guidance * restore attribute checks * fix attr * fix indent * PR Fixes * add attribute check in case of empty variable --------- Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Александр Бакановский <abakanovskii@astralinux.ru>
…ons#8532) * Add VM id and VM host to opennebula inventory data ##### SUMMARY <!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> <!--- Please do not forget to include a changelog fragment: https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments No need to include one for docs-only or test-only PR, and for new plugin/module PRs. Read about more details in CONTRIBUTING.md. --> ##### ISSUE TYPE <!--- Pick one or more below and delete the rest. 'Test Pull Request' is for PRs that add/extend tests without code changes. --> - Feature Pull Request ##### COMPONENT NAME <!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py ##### ADDITIONAL INFORMATION <!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue --> <!--- Paste verbatim command output below, e.g. before and after your change --> ```paste below "host": "foo23.host", "id": 1234, ``` * Create 8532-expand-opennuebula-inventory-data.yml * Update opennebula.py * Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Add check for empty records and add test * fix attribute test * fix attribute test * fix attribute test * fix attribute test * Update plugins/inventory/opennebula.py Co-authored-by: Felix Fontein <felix@fontein.de> * update as per guidance * restore attribute checks * fix attr * fix indent * PR Fixes * add attribute check in case of empty variable --------- Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Александр Бакановский <abakanovskii@astralinux.ru>
…ons#8532) * Add VM id and VM host to opennebula inventory data ##### SUMMARY <!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> <!--- Please do not forget to include a changelog fragment: https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments No need to include one for docs-only or test-only PR, and for new plugin/module PRs. Read about more details in CONTRIBUTING.md. --> ##### ISSUE TYPE <!--- Pick one or more below and delete the rest. 'Test Pull Request' is for PRs that add/extend tests without code changes. --> - Feature Pull Request ##### COMPONENT NAME <!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py ##### ADDITIONAL INFORMATION <!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue --> <!--- Paste verbatim command output below, e.g. before and after your change --> ```paste below "host": "foo23.host", "id": 1234, ``` * Create 8532-expand-opennuebula-inventory-data.yml * Update opennebula.py * Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Add check for empty records and add test * fix attribute test * fix attribute test * fix attribute test * fix attribute test * Update plugins/inventory/opennebula.py Co-authored-by: Felix Fontein <felix@fontein.de> * update as per guidance * restore attribute checks * fix attr * fix indent * PR Fixes * add attribute check in case of empty variable --------- Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Александр Бакановский <abakanovskii@astralinux.ru>
SUMMARY
To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory outputISSUE TYPE
COMPONENT NAME
opennebula.pyADDITIONAL INFORMATION