From 45366bddfc107395673454cea721354fc7e06433 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 28 Sep 2022 13:50:19 +0200 Subject: [PATCH] Work around for #1083 --- plugins/module_utils/cloud.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/module_utils/cloud.py b/plugins/module_utils/cloud.py index e690c0a8699..1a00ed26bb8 100644 --- a/plugins/module_utils/cloud.py +++ b/plugins/module_utils/cloud.py @@ -32,7 +32,12 @@ import time import functools import random -import ansible.module_utils.common.warnings as ansible_warnings + +try: + import ansible.module_utils.common.warnings as ansible_warnings + ANCIENT_ANSIBLE=False +except ImportError: + ANCIENT_ANSIBLE=True class BackoffIterator: @@ -200,9 +205,10 @@ def backoff(cls, tries=10, delay=3, backoff=1.1, catch_extra_error_codes=None): """ # This won't emit a warning (we don't have the context available to us), but will trigger # sanity failures as we prepare for 6.0.0 - ansible_warnings.deprecate( - 'CloudRetry.backoff has been deprecated, please use CloudRetry.exponential_backoff instead', - version='6.0.0', collection_name='amazon.aws') + if not ANCIENT_ANSIBLE: + ansible_warnings.deprecate( + 'CloudRetry.backoff has been deprecated, please use CloudRetry.exponential_backoff instead', + version='6.0.0', collection_name='amazon.aws') return cls.exponential_backoff( retries=tries,