Allow to use Ansible OpenStack Col. 1.x.x with openstacksdk >=0.99.0

Ansible OpenStack collection 1.x.x is not compatible to openstacksdk
>=0.99.0, only collection series 2.x.x will be. But the latter has
not been released yet.

This incompatibility only affects modules in Ansible OpenStack
Collection but not the functions that metalsmith uses. Those
functions ARE compatible with recent openstacksdk releases and
will most likely not be removed in collection release 2.0.0.

Thus, as a hacky workaround to allow using Ansible OpenStack
collection 1.x.x with openstacksdk >=0.99.0 this patch removes
the MAXIMUM_SDK_VERSION.

Change-Id: Icbcb0f92fc1e4315e81fe9ce0c2f9ce6b39867c2
This commit is contained in:
Jakob Meng 2022-10-11 14:35:50 +02:00
parent 523cc1d49a
commit ee008f7a79

View File

@ -423,6 +423,15 @@ def main():
raise RuntimeError(
'This module requires ansible-collections-openstack')
# Modules in Ansible OpenStack Collection prior to 2.0.0 are not compatible
# with openstacksdk >=0.99.0, but the functions used here ARE compatible
# and will most likely not be removed in collection release 2.0.0, so we
# can safely remove the MAXIMUM_SDK_VERSION and thus use this module with
# releases of openstacksdk.
# TODO: Remove once ansible-collections-openstack 2.0.0 has been released
from ansible.module_utils import openstack as aoc
aoc.MAXIMUM_SDK_VERSION = None
argument_spec = openstack_full_argument_spec(
**yaml.safe_load(DOCUMENTATION)['options']
)