mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudscale_volume: fail fast on volume type change (#52231)
* cloudscale_volume: fail fast on volume type change Currently a volume gets resized before the type change check. With this change, we check early and ensure we fail before any changes made. * fix too many blank lines
This commit is contained in:
parent
fcb6f136cd
commit
a1ec74334a
1 changed files with 6 additions and 6 deletions
|
@ -261,18 +261,18 @@ def main():
|
|||
volume.delete()
|
||||
|
||||
if module.params['state'] == 'present':
|
||||
for param, conv in (('server_uuids', set), ('size_gb', int)):
|
||||
if module.params[param] is None:
|
||||
continue
|
||||
if conv(volume.info[param]) != conv(module.params[param]):
|
||||
volume.update(param)
|
||||
|
||||
if (module.params['type'] is not None
|
||||
and volume.info['type'] != module.params['type']):
|
||||
module.fail_json(
|
||||
msg='Cannot change type of an existing volume.',
|
||||
)
|
||||
|
||||
for param, conv in (('server_uuids', set), ('size_gb', int)):
|
||||
if module.params[param] is None:
|
||||
continue
|
||||
if conv(volume.info[param]) != conv(module.params[param]):
|
||||
volume.update(param)
|
||||
|
||||
module.exit_json(changed=volume.changed, **volume.info)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue