mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-14 13:09:11 -07:00
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
This commit is contained in:
parent
2fbac8948d
commit
c6ed5b314d
1 changed files with 9 additions and 0 deletions
|
@ -181,6 +181,7 @@ def _update_stack(module, stack, cloud, sdk):
|
||||||
try:
|
try:
|
||||||
stack = cloud.update_stack(
|
stack = cloud.update_stack(
|
||||||
module.params['name'],
|
module.params['name'],
|
||||||
|
tags=module.params['tag'],
|
||||||
template_file=module.params['template'],
|
template_file=module.params['template'],
|
||||||
environment_files=module.params['environment'],
|
environment_files=module.params['environment'],
|
||||||
timeout=module.params['timeout'],
|
timeout=module.params['timeout'],
|
||||||
|
@ -248,6 +249,14 @@ def main():
|
||||||
if not stack:
|
if not stack:
|
||||||
stack = _create_stack(module, stack, cloud, sdk)
|
stack = _create_stack(module, stack, cloud, sdk)
|
||||||
else:
|
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)
|
stack = _update_stack(module, stack, cloud, sdk)
|
||||||
changed = True
|
changed = True
|
||||||
module.exit_json(changed=changed,
|
module.exit_json(changed=changed,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue