[5.0.0] Remove Ansible 2.9 / ansible-base 2.10 compatibility code (#4548)

* Remove Ansible 2.9 / ansible-base 2.10 compatibility code.

* Remove path_join shim from BOTMETA.

* Update comment.

* Bump minimally required ansible-core version.
This commit is contained in:
Felix Fontein 2022-04-26 11:51:01 +02:00 committed by GitHub
parent 36a0eca193
commit 1a9b3214fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 44 additions and 276 deletions

View file

@ -176,20 +176,11 @@ class CacheModule(BaseCacheModule):
def __init__(self, *args, **kwargs):
connection = ['127.0.0.1:11211']
try:
super(CacheModule, self).__init__(*args, **kwargs)
if self.get_option('_uri'):
connection = self.get_option('_uri')
self._timeout = self.get_option('_timeout')
self._prefix = self.get_option('_prefix')
except KeyError:
# TODO: remove once we no longer support Ansible 2.9
if not ansible_base_version.startswith('2.9.'):
raise AnsibleError("Do not import CacheModules directly. Use ansible.plugins.loader.cache_loader instead.")
if C.CACHE_PLUGIN_CONNECTION:
connection = C.CACHE_PLUGIN_CONNECTION.split(',')
self._timeout = C.CACHE_PLUGIN_TIMEOUT
self._prefix = C.CACHE_PLUGIN_PREFIX
super(CacheModule, self).__init__(*args, **kwargs)
if self.get_option('_uri'):
connection = self.get_option('_uri')
self._timeout = self.get_option('_timeout')
self._prefix = self.get_option('_prefix')
if not HAS_MEMCACHE:
raise AnsibleError("python-memcached is required for the memcached fact cache")