Fix the idempotent of compute_flavor module
if flavor's swap is not set (or 0),nova returns empty string [0] rather than 0 when query flavor spec. this behavior will break the idempotent of the ansible deployment. this ps changes the empty string to 0 before compare them. [0]: https://docs.openstack.org/api-ref/compute/?expanded=list-flavors-detail,list-flavors-with-details-detail#list-flavors-with-details Change-Id: I041cbcc0432051d795e2c3f0e7ac7378e1970008
This commit is contained in:
parent
8da4e852f0
commit
77acba047b
@ -220,6 +220,8 @@ def main():
|
|||||||
|
|
||||||
if flavor:
|
if flavor:
|
||||||
old_extra_specs = flavor['extra_specs']
|
old_extra_specs = flavor['extra_specs']
|
||||||
|
if flavor['swap'] == "":
|
||||||
|
flavor['swap'] = 0
|
||||||
for param_key in ['ram', 'vcpus', 'disk', 'ephemeral', 'swap', 'rxtx_factor', 'is_public']:
|
for param_key in ['ram', 'vcpus', 'disk', 'ephemeral', 'swap', 'rxtx_factor', 'is_public']:
|
||||||
if module.params[param_key] != flavor[param_key]:
|
if module.params[param_key] != flavor[param_key]:
|
||||||
require_update = True
|
require_update = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user