diff options
author | Mark Goddard <mark@stackhpc.com> | 2020-03-05 15:09:34 +0000 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2020-03-05 10:00:30 -0800 |
commit | 285ddf463e6dc1a997b26acfff19004adc05af8e (patch) | |
tree | b61f98e7c23ef25ccd8f26da8483d6dc03a43a90 | |
parent | 668cdc3ce88d9d69093a81271b34c69897ef2b57 (diff) | |
download | ansible-285ddf463e6dc1a997b26acfff19004adc05af8e.tar.gz |
OpenStack: ensure min_version is a string
https://github.com/ansible/ansible/pull/67577/files broke OpenStack
modules in Ansible 2.8.9. The problem is that min_version should be a
string, since it is passed to StrictVersion(). However, after that
change min_version ends up as a StrictVersion. This causes a TypeError
when later used to instantiate another StrictVersion:
TypeError: expected string or buffer
This change fixes the issue by ensuring min_version is a string. This
change is not required on other branches since the relevant code was
applied only in the 2.8 backport.
Fixes: #68042
-rw-r--r-- | lib/ansible/module_utils/openstack.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/openstack.py b/lib/ansible/module_utils/openstack.py index 1ac6c628e3..f75adc10d2 100644 --- a/lib/ansible/module_utils/openstack.py +++ b/lib/ansible/module_utils/openstack.py @@ -119,8 +119,9 @@ def openstack_cloud_from_module(module, min_version='0.12.0'): if min_version: min_version = max(StrictVersion('0.12.0'), StrictVersion(min_version)) + min_version = str(min_version) else: - min_version = StrictVersion('0.12.0') + min_version = '0.12.0' if min_version: if StrictVersion(sdk.version.__version__) < StrictVersion(min_version): |