diff options
author | Bharat Kunwar <b.kunwar@gmail.com> | 2019-04-04 15:43:31 +0200 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2019-04-04 15:43:31 +0200 |
commit | c6ed5b314dc211684cfd1342577d034b6de20fa3 (patch) | |
tree | 99a2900d819b897edd93c638a621f636b6c71d51 | |
parent | postgresql_idx: added CI tests for check_mode, rewrite code related with chec... (diff) | |
download | ansible-c6ed5b314dc211684cfd1342577d034b6de20fa3.tar.xz ansible-c6ed5b314dc211684cfd1342577d034b6de20fa3.zip |
Correctly update tags when os_stack invokes update_stack (#53757)
* Fix removal of tag when os_stack invokes update if a stack already exists.
* Add warning if a tag is provided and openstacksdk version is less than 0.27.0
* Fix pep8 errors
* Bump min_version up to 0.28.0
-rw-r--r-- | lib/ansible/modules/cloud/openstack/os_stack.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ansible/modules/cloud/openstack/os_stack.py b/lib/ansible/modules/cloud/openstack/os_stack.py index 3b3b20c516..9f3b1e7050 100644 --- a/lib/ansible/modules/cloud/openstack/os_stack.py +++ b/lib/ansible/modules/cloud/openstack/os_stack.py @@ -181,6 +181,7 @@ def _update_stack(module, stack, cloud, sdk): try: stack = cloud.update_stack( module.params['name'], + tags=module.params['tag'], template_file=module.params['template'], environment_files=module.params['environment'], timeout=module.params['timeout'], @@ -248,6 +249,14 @@ def main(): if not stack: stack = _create_stack(module, stack, cloud, sdk) else: + if module.params['tags']: + from distutils.version import StrictVersion + min_version = '0.28.0' + if StrictVersion(sdk.version.__version__) < StrictVersion(min_version): + module.warn("To update tags using os_stack module, the" + "installed version of the openstacksdk" + "library MUST be >={min_version}" + "".format(min_version=min_version)) stack = _update_stack(module, stack, cloud, sdk) changed = True module.exit_json(changed=changed, |