Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Work around for ansible-collections#1083

SUMMARY
The collection currently doesn't run on Ansible 2.9 (which we say we test against).
fixes: ansible-collections#1083
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/module_utils/cloud.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored Sep 29, 2022
1 parent 0040ed1 commit e0aeafd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/1083-__spec__-is-None.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- 'module_utils/cloud - Fix ``ValueError: ansible_collections.amazon.aws.plugins.module_utils.core.__spec__ is None`` error on Ansible 2.9 (https://github.com/ansible-collections/amazon.aws/issues/1083).'
14 changes: 10 additions & 4 deletions plugins/module_utils/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e0aeafd

Please sign in to comment.