From 93f8ce1ac7466a74bc98f0bec4e82e1f8c1b058b Mon Sep 17 00:00:00 2001 From: tjarra Date: Tue, 6 Sep 2022 17:46:35 -0300 Subject: [PATCH] Add eks_nodegroup waiters (#975) Add eks_nodegroup waiters SUMMARY Add waiters for eks_nodegroup module to manage deleted and created states. PR eks_nodegroup: ansible-collections/community.aws#1415 ISSUE TYPE Feature Pull Request COMPONENT NAME waiter.py Reviewed-by: Alina Buzachis --- .../fragments/975-waiters-eks_nodegroup.yml | 2 + plugins/module_utils/waiters.py | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 changelogs/fragments/975-waiters-eks_nodegroup.yml diff --git a/changelogs/fragments/975-waiters-eks_nodegroup.yml b/changelogs/fragments/975-waiters-eks_nodegroup.yml new file mode 100644 index 00000000000..67d6f939a49 --- /dev/null +++ b/changelogs/fragments/975-waiters-eks_nodegroup.yml @@ -0,0 +1,2 @@ +minor_changes: +- module_utils/waiters - Add waiters to manage eks_nodegroup module (https://github.com/ansible-collections/community.aws/pull/1415). \ No newline at end of file diff --git a/plugins/module_utils/waiters.py b/plugins/module_utils/waiters.py index 078894cb673..2abf390cbcf 100644 --- a/plugins/module_utils/waiters.py +++ b/plugins/module_utils/waiters.py @@ -535,6 +535,42 @@ "expected": "ResourceNotFoundException" } ] + }, + "NodegroupActive": { + "delay": 20, + "maxAttempts": 60, + "operation": "DescribeNodegroup", + "acceptors": [ + { + "state": "success", + "matcher": "path", + "argument": "nodegroup.status", + "expected": "ACTIVE" + }, + { + "state": "retry", + "matcher": "error", + "expected": "ResourceNotFoundException" + } + ] + }, + "NodegroupDeleted": { + "delay": 20, + "maxAttempts": 60, + "operation": "DescribeNodegroup", + "acceptors": [ + { + "state": "retry", + "matcher": "path", + "argument": "nodegroup.status == 'DELETING'", + "expected": True + }, + { + "state": "success", + "matcher": "error", + "expected": "ResourceNotFoundException" + } + ] } } } @@ -1108,6 +1144,18 @@ def route53_model(name): core_waiter.NormalizedOperationMethod( eks.describe_fargate_profile )), + ('EKS', 'nodegroup_active'): lambda eks: core_waiter.Waiter( + 'nodegroup_active', + eks_model('NodegroupActive'), + core_waiter.NormalizedOperationMethod( + eks.describe_nodegroup + )), + ('EKS', 'nodegroup_deleted'): lambda eks: core_waiter.Waiter( + 'nodegroup_deleted', + eks_model('NodegroupDeleted'), + core_waiter.NormalizedOperationMethod( + eks.describe_nodegroup + )), ('ElasticLoadBalancing', 'any_instance_in_service'): lambda elb: core_waiter.Waiter( 'any_instance_in_service', elb_model('AnyInstanceInService'),