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

ec2_key - fix idempotency issue when updating existing key pair #1383

Conversation

abikouo
Copy link
Contributor

@abikouo abikouo commented Feb 21, 2023

SUMMARY

when running module with state=present on existing key pair with the same key material the module raises the following issue

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: ansible_collections.amazon.aws.plugins.module_utils.modules.AnsibleAWSModule.exit_json() argument after ** must be a mapping, not NoneType
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.ec2_key', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.ec2_key', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_amazon.aws.ec2_key_payload_tghhfma0/ansible_amazon.aws.ec2_key_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_key.py\", line 389, in <module>\n  File \"/tmp/ansible_amazon.aws.ec2_key_payload_tghhfma0/ansible_amazon.aws.ec2_key_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_key.py\", line 385, in main\nTypeError: ansible_collections.amazon.aws.plugins.module_utils.modules.AnsibleAWSModule.exit_json() argument after ** must be a mapping, not NoneType\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

This pull request aims to fix this issue

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ec2_key

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/341976498eb449169866e5df8a2fda44

✔️ ansible-galaxy-importer SUCCESS in 3m 52s
✔️ build-ansible-collection SUCCESS in 12m 38s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 8m 37s (non-voting)
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 8m 33s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 9m 40s
✔️ ansible-test-sanity-aws-ansible-2.14 SUCCESS in 9m 30s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 8m 38s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 7m 47s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 9m 54s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 9m 21s
✔️ cloud-tox-py3 SUCCESS in 8m 40s
✔️ ansible-test-changelog SUCCESS in 4m 22s
✔️ ansible-test-splitter SUCCESS in 4m 52s
✔️ integration-amazon.aws-1 SUCCESS in 5m 50s
Skipped 43 jobs

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/0ee2fbb787f94f75bcae63e33045fba0

✔️ ansible-galaxy-importer SUCCESS in 4m 20s
✔️ build-ansible-collection SUCCESS in 12m 15s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 10m 57s (non-voting)
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 11m 08s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 10m 48s
✔️ ansible-test-sanity-aws-ansible-2.14 SUCCESS in 11m 03s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 12m 27s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 10m 06s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 10m 10s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 10m 03s
✔️ cloud-tox-py3 SUCCESS in 6m 20s
✔️ ansible-test-changelog SUCCESS in 4m 13s
✔️ ansible-test-splitter SUCCESS in 4m 35s
✔️ integration-amazon.aws-1 SUCCESS in 5m 51s
Skipped 43 jobs

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/ec7147e8212c49cd82e8b4609468a6dc

✔️ ansible-galaxy-importer SUCCESS in 3m 58s
✔️ build-ansible-collection SUCCESS in 12m 33s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 10m 43s (non-voting)
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 11m 32s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 11m 32s
✔️ ansible-test-sanity-aws-ansible-2.14 SUCCESS in 10m 14s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 9m 30s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 10m 11s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 11m 18s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 9m 28s
✔️ cloud-tox-py3 SUCCESS in 8m 15s
✔️ ansible-test-changelog SUCCESS in 4m 13s
✔️ ansible-test-splitter SUCCESS in 4m 45s
✔️ integration-amazon.aws-1 SUCCESS in 6m 30s
Skipped 43 jobs

@tremble tremble added this to the 5.3.0 milestone Feb 23, 2023
@tremble tremble added mergeit Merge the PR (SoftwareFactory) backport-5 PR should be backported to the stable-5 branch labels Feb 27, 2023
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/c833ecb913c947b4b786d3aed9045ccc

✔️ ansible-galaxy-importer SUCCESS in 8m 46s
✔️ build-ansible-collection SUCCESS in 12m 32s
✔️ ansible-test-splitter SUCCESS in 4m 34s
✔️ integration-amazon.aws-1 SUCCESS in 5m 58s
Skipped 43 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit b769b6a into ansible-collections:main Feb 27, 2023
@patchback
Copy link

patchback bot commented Feb 27, 2023

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/b769b6a9b6b564ed4b65636a70aaf802a90c0b9b/pr-1383

Backported as #1392

🤖 @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 Feb 27, 2023
…al (#1383)

ec2_key - fix idempotency issue when updating existing key pair

SUMMARY

when running module with state=present on existing key pair with the same key material the module raises the following issue
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: ansible_collections.amazon.aws.plugins.module_utils.modules.AnsibleAWSModule.exit_json() argument after ** must be a mapping, not NoneType
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.ec2_key', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.ec2_key', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_amazon.aws.ec2_key_payload_tghhfma0/ansible_amazon.aws.ec2_key_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_key.py\", line 389, in <module>\n  File \"/tmp/ansible_amazon.aws.ec2_key_payload_tghhfma0/ansible_amazon.aws.ec2_key_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_key.py\", line 385, in main\nTypeError: ansible_collections.amazon.aws.plugins.module_utils.modules.AnsibleAWSModule.exit_json() argument after ** must be a mapping, not NoneType\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

This pull request aims to fix this issue

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_key

Reviewed-by: Mark Chappell
Reviewed-by: Bikouo Aubin
(cherry picked from commit b769b6a)
@github-actions
Copy link

Docs Build 📝

Thank you for contribution!✨

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

softwarefactory-project-zuul bot pushed a commit that referenced this pull request Feb 27, 2023
…al (#1383) (#1392)

[PR #1383/b769b6a9 backport][stable-5] ec2_key - fix idempotency issue when updating existing key pair

This is a backport of PR #1383 as merged into main (b769b6a).
SUMMARY

when running module with state=present on existing key pair with the same key material the module raises the following issue
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: ansible_collections.amazon.aws.plugins.module_utils.modules.AnsibleAWSModule.exit_json() argument after ** must be a mapping, not NoneType
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/aubin/.ansible/tmp/ansible-tmp-1676994806.9488113-2761194-77181612241045/AnsiballZ_ec2_key.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.ec2_key', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.ec2_key', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_amazon.aws.ec2_key_payload_tghhfma0/ansible_amazon.aws.ec2_key_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_key.py\", line 389, in <module>\n  File \"/tmp/ansible_amazon.aws.ec2_key_payload_tghhfma0/ansible_amazon.aws.ec2_key_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_key.py\", line 385, in main\nTypeError: ansible_collections.amazon.aws.plugins.module_utils.modules.AnsibleAWSModule.exit_json() argument after ** must be a mapping, not NoneType\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

This pull request aims to fix this issue

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_key

Reviewed-by: Mark Chappell
reparepo pushed a commit to reparepo/amazon.aws that referenced this pull request Mar 17, 2023
…#1384)

route53_info - fix max_items when not paginating

SUMMARY
As reported in ansible-collections#1383, the route53_info module presently fails to run with a boto3 parameter validation error if run with particular combinations of parameters, specifically:

query: hosted_zone parameter with hosted_zone_method: list_by_name
query: reusable_delegation_set without specifying a delegation_set_id

I believe this is a regression introduced in ansible-collections#813
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53_info
ADDITIONAL INFORMATION
Some further information is described in the issue but tl;dr the prior PR converted all cases in the module where params['MaxItems'] was set to instead pass a params['PaginationConfig'], however this should only be done if a boto3 paginator is actually being used, and will fail (as noted above, due to parameter validation) if called with a regular boto3 client method.
Hence this PR switches back to directly setting MaxItems on the methods that do not use a paginator.

Reviewed-by: Mark Chappell <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@569fff4
abikouo pushed a commit to abikouo/amazon.aws that referenced this pull request Sep 18, 2023
…#1384)

route53_info - fix max_items when not paginating

SUMMARY
As reported in ansible-collections#1383, the route53_info module presently fails to run with a boto3 parameter validation error if run with particular combinations of parameters, specifically:

query: hosted_zone parameter with hosted_zone_method: list_by_name
query: reusable_delegation_set without specifying a delegation_set_id

I believe this is a regression introduced in ansible-collections#813
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53_info
ADDITIONAL INFORMATION
Some further information is described in the issue but tl;dr the prior PR converted all cases in the module where params['MaxItems'] was set to instead pass a params['PaginationConfig'], however this should only be done if a boto3 paginator is actually being used, and will fail (as noted above, due to parameter validation) if called with a regular boto3 client method.
Hence this PR switches back to directly setting MaxItems on the methods that do not use a paginator.

Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this pull request Sep 18, 2023
…#1384)

route53_info - fix max_items when not paginating

SUMMARY
As reported in ansible-collections#1383, the route53_info module presently fails to run with a boto3 parameter validation error if run with particular combinations of parameters, specifically:

query: hosted_zone parameter with hosted_zone_method: list_by_name
query: reusable_delegation_set without specifying a delegation_set_id

I believe this is a regression introduced in ansible-collections#813
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53_info
ADDITIONAL INFORMATION
Some further information is described in the issue but tl;dr the prior PR converted all cases in the module where params['MaxItems'] was set to instead pass a params['PaginationConfig'], however this should only be done if a boto3 paginator is actually being used, and will fail (as noted above, due to parameter validation) if called with a regular boto3 client method.
Hence this PR switches back to directly setting MaxItems on the methods that do not use a paginator.

Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this pull request Oct 24, 2023
…#1384)

route53_info - fix max_items when not paginating

SUMMARY
As reported in ansible-collections#1383, the route53_info module presently fails to run with a boto3 parameter validation error if run with particular combinations of parameters, specifically:

query: hosted_zone parameter with hosted_zone_method: list_by_name
query: reusable_delegation_set without specifying a delegation_set_id

I believe this is a regression introduced in ansible-collections#813
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53_info
ADDITIONAL INFORMATION
Some further information is described in the issue but tl;dr the prior PR converted all cases in the module where params['MaxItems'] was set to instead pass a params['PaginationConfig'], however this should only be done if a boto3 paginator is actually being used, and will fail (as noted above, due to parameter validation) if called with a regular boto3 client method.
Hence this PR switches back to directly setting MaxItems on the methods that do not use a paginator.

Reviewed-by: Mark Chappell <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-5 PR should be backported to the stable-5 branch mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants