Skip to content
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

Fixed XenOrchestra inventory plugin failing due to not checking response ID. #6227

Merged
merged 6 commits into from
Mar 26, 2023

Conversation

lkirkwood
Copy link
Contributor

@lkirkwood lkirkwood commented Mar 24, 2023

SUMMARY

I ran into an issue where about 1/3 of the time, when using the XenOrchestra inventory plugin, the process would fail due to the first response from the XO server received being unrelated to the request. This can be easily fixed by checking that the response ID is the same as the request ID, which is what this change does.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

xen_orchestra inventory

ADDITIONAL INFORMATION

The messages from the server that cause the issue vary, but one that I noticed frequently is shown below:

{
  "jsonrpc": "2.0",
  "method": "all",
  "params": {
    "type": "exit",
    "items": {
      "eb859a79-1725-eecd-67e6-b9bf941205e4": 0
    }
  }
}

Before change:

[ansible@ansible-machine ~]$ ansible-inventory -i /etc/ansible/xen_orchestra.yml --graph
[WARNING]:  * Failed to parse /etc/ansible/xen_orchestra.yml with ansible_collections.community.general.plugins.inventory.xen_orchestra plugin: 'result'
[WARNING]: Unable to parse /etc/ansible/xen_orchestra.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
@all:
  |--@ungrouped:

After change:

[ansible@ansible-machine ~]$ ansible-inventory -i /etc/ansible/xen_orchestra.yml --graph                                                                   @all:
  |--@halted:                                                                                                                                                              
  |  |--027c4638-0ad1-aab3-bc38-0c34a0009058                                                                                                                            
  |  |--02ddbd9b-af42-bab1-6811-e1e22ba719bf                                                                                                                             
  |  |--058c4616-ee04-b310-7aa8-95fb0aedab08
...

@lkirkwood lkirkwood marked this pull request as ready for review March 24, 2023 04:30
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug inventory inventory plugin new_contributor Help guide this first time contributor plugins plugin (any type) labels Mar 24, 2023
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed WIP Work in progress labels Mar 24, 2023
@ansibullbot ansibullbot removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Mar 24, 2023
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

plugins/inventory/xen_orchestra.py Outdated Show resolved Hide resolved
plugins/inventory/xen_orchestra.py Outdated Show resolved Hide resolved
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-5 labels Mar 24, 2023
@lkirkwood
Copy link
Contributor Author

I have made the changes you suggested. Thanks :)

@github-actions
Copy link

github-actions bot commented Mar 24, 2023

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Mar 26, 2023
@felixfontein felixfontein merged commit cd70645 into ansible-collections:main Mar 26, 2023
@patchback
Copy link

patchback bot commented Mar 26, 2023

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/cd706454eca6bcae5e495fa27b041f350ffda21e/pr-6227

Backported as #6244

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@lirkwood thanks for your contribution!

patchback bot pushed a commit that referenced this pull request Mar 26, 2023
…nse ID. (#6227)

* Added call method to select proper response from xo server

* Added changelog fragment

* Removed excess blank lines

* Moved period in changelog fragment

* Made suggested changes

* Remove f-strings for Python 2.7 compatibility

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Linus Kirkwood <lkirkwood@allette.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cd70645)
@patchback
Copy link

patchback bot commented Mar 26, 2023

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/cd706454eca6bcae5e495fa27b041f350ffda21e/pr-6227

Backported as #6245

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Mar 26, 2023
…nse ID. (#6227)

* Added call method to select proper response from xo server

* Added changelog fragment

* Removed excess blank lines

* Moved period in changelog fragment

* Made suggested changes

* Remove f-strings for Python 2.7 compatibility

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Linus Kirkwood <lkirkwood@allette.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cd70645)
felixfontein pushed a commit that referenced this pull request Mar 26, 2023
…lugin failing due to not checking response ID. (#6244)

Fixed XenOrchestra inventory plugin failing due to not checking response ID. (#6227)

* Added call method to select proper response from xo server

* Added changelog fragment

* Removed excess blank lines

* Moved period in changelog fragment

* Made suggested changes

* Remove f-strings for Python 2.7 compatibility

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Linus Kirkwood <lkirkwood@allette.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cd70645)

Co-authored-by: lirkwood <linuskirkwood@gmail.com>
felixfontein pushed a commit that referenced this pull request Mar 26, 2023
…lugin failing due to not checking response ID. (#6245)

Fixed XenOrchestra inventory plugin failing due to not checking response ID. (#6227)

* Added call method to select proper response from xo server

* Added changelog fragment

* Removed excess blank lines

* Moved period in changelog fragment

* Made suggested changes

* Remove f-strings for Python 2.7 compatibility

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Linus Kirkwood <lkirkwood@allette.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cd70645)

Co-authored-by: lirkwood <linuskirkwood@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug inventory inventory plugin new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants