diff options
author | Sloane Hertel <shertel@redhat.com> | 2018-02-01 14:08:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-01 14:08:59 -0500 |
commit | ee209e5f6fa2fe7c5e4ba21b9e7a92b658014e02 (patch) | |
tree | 65454528fd7153e7470087a97275dd048acd9ef4 | |
parent | b9571eb4bf7cb8dfd95fe6e04deb4326ebbb6d75 (diff) | |
download | ansible-ee209e5f6fa2fe7c5e4ba21b9e7a92b658014e02.tar.gz |
Fix idempotence for deleting ElasticBeanstalk applications (#35614)
-rw-r--r-- | lib/ansible/modules/cloud/amazon/aws_elasticbeanstalk_app.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ansible/modules/cloud/amazon/aws_elasticbeanstalk_app.py b/lib/ansible/modules/cloud/amazon/aws_elasticbeanstalk_app.py index ad581369a0..1318199348 100644 --- a/lib/ansible/modules/cloud/amazon/aws_elasticbeanstalk_app.py +++ b/lib/ansible/modules/cloud/amazon/aws_elasticbeanstalk_app.py @@ -209,10 +209,16 @@ def main(): ebs.delete_application(ApplicationName=app_name, TerminateEnvByForce=terminate_by_force) else: ebs.delete_application(ApplicationName=app_name) - except (BotoCoreError, ClientError) as e: + changed = True + except BotoCoreError as e: module.fail_json_aws(e, msg="Cannot terminate app") + except ClientError as e: + if 'It is currently pending deletion.' not in e.response['Error']['Message']: + module.fail_json_aws(e, msg="Cannot terminate app") + else: + changed = False - result = dict(changed=True, app=app) + result = dict(changed=changed, app=app) module.exit_json(**result) |