From f02f80926b14d2bd320fa968135c6e12c0d3c6e7 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Sat, 1 May 2021 14:00:16 +0200 Subject: [PATCH 1/2] Add route53 waiter with throttling retries --- plugins/module_utils/waiters.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/plugins/module_utils/waiters.py b/plugins/module_utils/waiters.py index b538a4eb409..0996c4a0781 100644 --- a/plugins/module_utils/waiters.py +++ b/plugins/module_utils/waiters.py @@ -469,6 +469,26 @@ } +route53_data = { + "version": 2, + "waiters": { + "ResourceRecordSetsChanged": { + "delay": 30, + "maxAttempts": 60, + "operation": "GetChange", + "acceptors": [ + { + "matcher": "path", + "expected": "INSYNC", + "argument": "ChangeInfo.Status", + "state": "success" + } + ] + } + } +} + + def _inject_limit_retries(model): extra_retries = [ @@ -508,6 +528,11 @@ def rds_model(name): return rds_models.get_waiter(name) +def route53_model(name): + route53_models = core_waiter.WaiterModel(waiter_config=_inject_limit_retries(route53_data)) + return route53_models.get_waiter(name) + + waiters_by_name = { ('EC2', 'image_available'): lambda ec2: core_waiter.Waiter( 'image_available', @@ -671,6 +696,12 @@ def rds_model(name): core_waiter.NormalizedOperationMethod( rds.describe_db_instances )), + ('Route53', 'resource_record_sets_changed'): lambda route53: core_waiter.Waiter( + 'resource_record_sets_changed', + route53_model('ResourceRecordSetsChanged'), + core_waiter.NormalizedOperationMethod( + route53.get_change + )), } From 7cabe352291da580dbfedc7919d3cedc821399df Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Sat, 1 May 2021 14:05:03 +0200 Subject: [PATCH 2/2] changelog --- changelogs/fragments/350-route53-waiter.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/350-route53-waiter.yml diff --git a/changelogs/fragments/350-route53-waiter.yml b/changelogs/fragments/350-route53-waiter.yml new file mode 100644 index 00000000000..d05036c83c3 --- /dev/null +++ b/changelogs/fragments/350-route53-waiter.yml @@ -0,0 +1,2 @@ +minor_changes: +- module_utils/waiter - add Route53 ``resource_record_sets_changed`` waiter (https://github.com/ansible-collections/amazon.aws/pull/350).