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

Don't hardcode max_attempts, as it leads to errors when AMI builds lo… #194

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/194-ec2-ami-max-attempts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- ec2_ami - fixed and streamlined max_attempts logic when waiting for AMIs to finish and increased wait_timeout to 1200 for a more reliably module run.
stefanhorning marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 4 additions & 4 deletions plugins/modules/ec2_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
wait_timeout:
description:
- How long before wait gives up, in seconds.
default: 900
default: 1200
type: int
state:
description:
Expand Down Expand Up @@ -505,9 +505,9 @@ def create_image(module, connection):
module.fail_json_aws(e, msg="Error registering image")

if wait:
delay = 15
max_attempts = wait_timeout // delay
waiter = get_waiter(connection, 'image_available')
delay = wait_timeout // 30
max_attempts = 30
waiter.wait(ImageIds=[image_id], WaiterConfig=dict(Delay=delay, MaxAttempts=max_attempts))

if tags:
Expand Down Expand Up @@ -718,7 +718,7 @@ def main():
delete_snapshot=dict(default=False, type='bool'),
name=dict(),
wait=dict(type='bool', default=False),
wait_timeout=dict(default=900, type='int'),
wait_timeout=dict(default=1200, type='int'),
description=dict(default=''),
no_reboot=dict(default=False, type='bool'),
state=dict(default='present', choices=['present', 'absent']),
Expand Down