From ee008f7a79f079df98ec4a8556b3a067f4eb348a Mon Sep 17 00:00:00 2001 From: Jakob Meng Date: Tue, 11 Oct 2022 14:35:50 +0200 Subject: [PATCH] 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 --- .../ansible_plugins/modules/metalsmith_instances.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/metalsmith_ansible/ansible_plugins/modules/metalsmith_instances.py b/metalsmith_ansible/ansible_plugins/modules/metalsmith_instances.py index 3aa1d9e..fc28918 100644 --- a/metalsmith_ansible/ansible_plugins/modules/metalsmith_instances.py +++ b/metalsmith_ansible/ansible_plugins/modules/metalsmith_instances.py @@ -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'] )