1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ec2_ami_copy: Fix unreferenced variable error (#47598)

Fixes: #47595

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-11-13 18:52:32 +05:30 committed by ansibot
parent ddd378e622
commit 27827ce728

View file

@ -142,6 +142,7 @@ image_id:
from ansible.module_utils.aws.core import AnsibleAWSModule
from ansible.module_utils.ec2 import ec2_argument_spec
from ansible.module_utils.ec2 import camel_dict_to_snake_dict, ansible_dict_to_boto3_tag_list
from ansible.module_utils._text import to_native
try:
from botocore.exceptions import ClientError, NoCredentialsError, WaiterError, BotoCoreError
@ -189,6 +190,7 @@ def copy_image(module, ec2):
if module.params.get('wait'):
delay = 15
max_attempts = module.params.get('wait_timeout') // delay
image_id = image.get('ImageId')
ec2.get_waiter('image_available').wait(
ImageIds=[image_id],
WaiterConfig={'Delay': delay, 'MaxAttempts': max_attempts}
@ -200,7 +202,7 @@ def copy_image(module, ec2):
except (ClientError, BotoCoreError) as e:
module.fail_json_aws(e, msg="Could not copy AMI")
except Exception as e:
module.fail_json(msg='Unhandled exception. (%s)' % str(e))
module.fail_json(msg='Unhandled exception. (%s)' % to_native(e))
def main():