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

Fix for vmadm get_vm_uuid out of range #5628

Merged
merged 3 commits into from
Nov 30, 2022

Conversation

cneira
Copy link
Contributor

@cneira cneira commented Nov 29, 2022

SUMMARY

Method get_vm_uuid from vmadm off-by-one error.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmadm

ADDITIONAL INFORMATION

When running a playbook using the vmadm module results in:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: Replacement index 1 out of range for positional args tuple
fatal: [192.168.1.111]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.1.111 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 47, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.vmadm', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.vmadm', _modlib_path=modlib_path),\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 224, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 86, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 785, in <module>\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 730, in main\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 441, in get_vm_uuid\r\nIndexError: Replacement index 1 out of range for positional args tuple\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

```bash
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: Replacement index 1 out of range for positional args tuple
fatal: [192.168.1.111]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.1.111 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 47, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.vmadm', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.vmadm', _modlib_path=modlib_path),\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 224, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 86, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 785, in <module>\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 730, in main\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 441, in get_vm_uuid\r\nIndexError: Replacement index 1 out of range for positional args tuple\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug cloud module module new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review traceback labels Nov 29, 2022
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! Could you please add a changelog fragment? Thanks!

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-5 labels Nov 29, 2022
```bash
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: Replacement index 1 out of range for positional args tuple
fatal: [192.168.1.111]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.1.111 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1669747224.152739-62818-126536782663630/AnsiballZ_vmadm.py\", line 47, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.vmadm', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.vmadm', _modlib_path=modlib_path),\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 224, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/opt/tools/lib/python3.10/runpy.py\", line 86, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 785, in <module>\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 730, in main\r\n  File \"/tmp/ansible_community.general.vmadm_payload_jpca_c47/ansible_community.general.vmadm_payload.zip/ansible_collections/community/general/plugins/modules/vmadm.py\", line 441, in get_vm_uuid\r\nIndexError: Replacement index 1 out of range for positional args tuple\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```
@cneira
Copy link
Contributor Author

cneira commented Nov 30, 2022

Thanks for your contribution! Could you please add a changelog fragment? Thanks!

done!

@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Nov 30, 2022
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein merged commit b8545d1 into ansible-collections:main Nov 30, 2022
@patchback
Copy link

patchback bot commented Nov 30, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/b8545d10e6dc0655995fe354b285871ce1f263b2/pr-5628

Backported as #5634

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

@felixfontein
Copy link
Collaborator

@cneira thanks for fixing this!

patchback bot pushed a commit that referenced this pull request Nov 30, 2022
* Fix for vmadm get_vm_uuid out of range

* Fix for vmadm get_vm_uuid out of range

* Update changelogs/fragments/5628-fix-vmadm-off-by-one.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b8545d1)
@patchback
Copy link

patchback bot commented Nov 30, 2022

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/b8545d10e6dc0655995fe354b285871ce1f263b2/pr-5628

Backported as #5635

🤖 @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 Nov 30, 2022
* Fix for vmadm get_vm_uuid out of range

* Fix for vmadm get_vm_uuid out of range

* Update changelogs/fragments/5628-fix-vmadm-off-by-one.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b8545d1)
felixfontein pushed a commit that referenced this pull request Nov 30, 2022
* Fix for vmadm get_vm_uuid out of range

* Fix for vmadm get_vm_uuid out of range

* Update changelogs/fragments/5628-fix-vmadm-off-by-one.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b8545d1)

Co-authored-by: Carlos Neira <cneirabustos@gmail.com>
felixfontein pushed a commit that referenced this pull request Nov 30, 2022
* Fix for vmadm get_vm_uuid out of range

* Fix for vmadm get_vm_uuid out of range

* Update changelogs/fragments/5628-fix-vmadm-off-by-one.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b8545d1)

Co-authored-by: Carlos Neira <cneirabustos@gmail.com>
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 1, 2022
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 cloud module module new_contributor Help guide this first time contributor plugins plugin (any type) traceback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants