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_snapshot tagging fails on KeyError #373

Closed
jillr opened this issue May 21, 2021 · 3 comments · Fixed by #383
Closed

ec2_snapshot tagging fails on KeyError #373

jillr opened this issue May 21, 2021 · 3 comments · Fixed by #383
Assignees
Labels
bug This issue/PR relates to a bug jira module module needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly plugins plugin (any type) python3 traceback

Comments

@jillr
Copy link
Collaborator

jillr commented May 21, 2021

SUMMARY

Seen in the ec2_ami tests, so we're probably missing a test case in the ec2_snapshot tests.
Line 273, in create_snapshot\nKeyError: 'Tags'\n",

Most likely missed in the recent boto3 refactor (#356)

In addition to fixing the bug we should also make sure this is covered in the ec2_snapshot tests.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ec2_snapshot

ACTUAL RESULTS
TASK [ec2_ami : take a snapshot of the instance to create an image] ************
task path: /root/ansible_collections/amazon/aws/tests/output/.tmp/integration/ec2_ami-qpswqi_j-ÅÑŚÌβŁÈ/tests/integration/targets/ec2_ami/tasks/main.yml:61
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497 `" && echo ansible-tmp-1621616359.7019289-355-96243348815497="` echo /r
oot/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497 `" ) && sleep 0'
Using module file /root/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py
<testhost> PUT /root/.ansible/tmp/ansible-local-152y4ioog9_/tmpfswyc7hi TO /root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py
<testhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/ /root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py && sleep 0'
<testhost> EXEC /bin/sh -c 'ANSIBLE_DEBUG_BOTOCORE_LOGS=True /usr/bin/python3.7 /root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py && sleep 0'
<testhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py", line 114, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py", line 106, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py", line 55, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_ec2_snapshot_payload_31bj2uai/ansible_ec2_snapshot_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py", line 410, in <module>
  File "/tmp/ansible_ec2_snapshot_payload_31bj2uai/ansible_ec2_snapshot_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py", line 405, in main
  File "/tmp/ansible_ec2_snapshot_payload_31bj2uai/ansible_ec2_snapshot_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py", line 273, in create_snapshot
KeyError: 'Tags'
fatal: [testhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1621616359.7019289-355-96243348815497/AnsiballZ_ec2_snapshot.py\", line 55, in invoke_module\n    run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.7/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.7/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ec2_snapshot_payload_31bj2uai/ansible_ec2_snapshot_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py\", line 410, in <module>\n  File \"/tmp/ansible_ec2_snapshot_payload_31bj2uai/ansible_ec2_snapshot_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py\", line 405, in main\n  File \"/tmp/ansible_ec2_snapshot_payload_31bj2uai/ansible_ec2_snapshot_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_snapshot.py\", line 273, in create_snapshot\nKeyError: 'Tags'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@jillr: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • ansible version

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly needs_triage plugins plugin (any type) python3 traceback labels May 21, 2021
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue May 25, 2021
…lections#373)

* ec2_instance: build results inside find_instances and add backoff

* Add retry decorator to ec2 clients
@jillr jillr added the jira label May 25, 2021
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
…lections#373)

* ec2_instance: build results inside find_instances and add backoff

* Add retry decorator to ec2 clients
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
…lections#373)

* ec2_instance: build results inside find_instances and add backoff

* Add retry decorator to ec2 clients
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
…lections#373)

* ec2_instance: build results inside find_instances and add backoff

* Add retry decorator to ec2 clients
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 jira module module needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly plugins plugin (any type) python3 traceback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants