diff --git a/ci/run-ansible-tests-collection.sh b/ci/run-ansible-tests-collection.sh index cd31cf13..3400dbc4 100755 --- a/ci/run-ansible-tests-collection.sh +++ b/ci/run-ansible-tests-collection.sh @@ -104,9 +104,6 @@ for var in $(env | grep -e '^ANSIBLE_VAR_'); do ANSIBLE_VARS+="${ANSIBLE_VAR_NAME}=${ANSIBLE_VAR_VALUE} " # concat variables done -# Discover openstacksdk version -SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)") - # Choose integration tests tag_opt="" if [ -n "$TAGS" ]; then @@ -136,5 +133,5 @@ set -o pipefail # shellcheck disable=SC2086 ANSIBLE_COLLECTIONS_PATH=$TEST_COLLECTIONS_PATHS ansible-playbook \ -vvv ./run-collection.yml \ - -e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} ${ANSIBLE_VARS}" \ + -e "cloud=${CLOUD} cloud_alt=${CLOUD_ALT} ${ANSIBLE_VARS}" \ ${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log diff --git a/docs/devstack.md b/docs/devstack.md index fb8e8668..a64ec3d3 100644 --- a/docs/devstack.md +++ b/docs/devstack.md @@ -79,8 +79,7 @@ list(conn.network.ips())[0].to_dict(computed=False) To run the unit tests of the collection, run this in a Bash shell: ```sh -SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)") -ansible-playbook -vvv ci/run-collection.yml -e "sdk_version=${SDK_VER} cloud=devstack-admin cloud_alt=devstack-alt" +ansible-playbook -vvv ci/run-collection.yml -e "cloud=devstack-admin cloud_alt=devstack-alt" ``` Use `ansible-playbook`'s `--tags` and `--skip-tags` parameters to skip CI tests. For a list of available tags, refer to diff --git a/docs/reviewing.md b/docs/reviewing.md index ed629ba2..7aea7757 100644 --- a/docs/reviewing.md +++ b/docs/reviewing.md @@ -48,7 +48,7 @@ How to do a review? What to look for when reviewing patches? Example: ```sh ansible-playbook -vvv ci/run-collection.yml \ - -e "sdk_version=1.0.0 cloud=devstack-admin cloud_alt=devstack-alt" \ + -e "cloud=devstack-admin cloud_alt=devstack-alt" \ --tags floating_ip_info ``` * Does a patch remove any functionality or break backwards compatibility? The author must give a good explanation for diff --git a/plugins/inventory/openstack.py b/plugins/inventory/openstack.py index a4089555..639db979 100644 --- a/plugins/inventory/openstack.py +++ b/plugins/inventory/openstack.py @@ -155,9 +155,6 @@ import sys from ansible.errors import AnsibleParserError from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable -from ansible_collections.openstack.cloud.plugins.module_utils.openstack import ( - ensure_compatibility -) try: import openstack @@ -179,12 +176,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): raise AnsibleParserError( 'Could not import Python library openstacksdk') - try: - ensure_compatibility(openstack.version.__version__) - except ImportError as e: - raise AnsibleParserError( - 'Incompatible openstacksdk library found: {0}'.format(e)) - # Redirect logging to stderr so it does not mix with output, in # particular JSON output of ansible-inventory. # TODO: Integrate openstack's logging with Ansible's logging. diff --git a/plugins/module_utils/openstack.py b/plugins/module_utils/openstack.py index 827b4fb7..9dd9e504 100644 --- a/plugins/module_utils/openstack.py +++ b/plugins/module_utils/openstack.py @@ -47,45 +47,8 @@ import os from ansible.module_utils.basic import AnsibleModule OVERRIDES = {} - CUSTOM_VAR_PARAMS = ['min_ver', 'max_ver'] -MINIMUM_SDK_VERSION = '1.0.0' -MAXIMUM_SDK_VERSION = None - - -def ensure_compatibility(version, min_version=None, max_version=None): - """ Raises ImportError if the specified version does not - meet the minimum and maximum version requirements""" - - if min_version and MINIMUM_SDK_VERSION: - min_version = max(StrictVersion(MINIMUM_SDK_VERSION), - StrictVersion(min_version)) - elif MINIMUM_SDK_VERSION: - min_version = StrictVersion(MINIMUM_SDK_VERSION) - - if max_version and MAXIMUM_SDK_VERSION: - max_version = min(StrictVersion(MAXIMUM_SDK_VERSION), - StrictVersion(max_version)) - elif MAXIMUM_SDK_VERSION: - max_version = StrictVersion(MAXIMUM_SDK_VERSION) - - if min_version and StrictVersion(version) < min_version: - raise ImportError( - "Version MUST be >={min_version} and <={max_version}, but" - " {version} is smaller than minimum version {min_version}" - .format(version=version, - min_version=min_version, - max_version=max_version)) - - if max_version and StrictVersion(version) > max_version: - raise ImportError( - "Version MUST be >={min_version} and <={max_version}, but" - " {version} is larger than maximum version {max_version}" - .format(version=version, - min_version=min_version, - max_version=max_version)) - def openstack_argument_spec(): # DEPRECATED: This argument spec is only used for the deprecated old @@ -164,14 +127,6 @@ def openstack_cloud_from_module(module, min_version=None, max_version=None): except ImportError: module.fail_json(msg='openstacksdk is required for this module') - try: - ensure_compatibility(sdk.version.__version__, - min_version, max_version) - except ImportError as e: - module.fail_json( - msg="Incompatible openstacksdk library found: {error}." - .format(error=str(e))) - cloud_config = module.params.pop('cloud', None) try: if isinstance(cloud_config, dict): @@ -244,8 +199,6 @@ class OpenStackModule: deprecated_names = () argument_spec = {} module_kwargs = {} - module_min_sdk_version = None - module_max_sdk_version = None def __init__(self): """Initialize Openstack base class. @@ -314,19 +267,9 @@ class OpenStackModule: try: # Due to the name shadowing we should import other way sdk = importlib.import_module('openstack') - self.sdk_version = sdk.version.__version__ except ImportError: self.fail_json(msg='openstacksdk is required for this module') - try: - ensure_compatibility(self.sdk_version, - self.module_min_sdk_version, - self.module_max_sdk_version) - except ImportError as e: - self.fail_json( - msg="Incompatible openstacksdk library found: {error}." - .format(error=str(e))) - # Fail if there are set unsupported for this version parameters # New parameters should NOT use 'default' but rely on SDK defaults for param in self.argument_spec: