os_coe_cluster: Retrive id/uuid correctly
Fix https://github.com/ansible/ansible/issues/67576 Change-Id: I59b07a8733d549015ed1999e30970d1131c82f99 Signed-off-by: Bharat Kunwar <brtknr@bath.edu>
This commit is contained in:
parent
78937f4d41
commit
050acb6c03
changelogs/fragments
plugins/modules
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- os_coe_cluster: Retrieve the correct id/uuid depending on whether it is a create/get request.
|
@ -187,7 +187,7 @@ cluster:
|
|||||||
- The time in UTC at which the cluster is updated
|
- The time in UTC at which the cluster is updated
|
||||||
type: str
|
type: str
|
||||||
sample: '2018-08-16T10:39:25+00:00'
|
sample: '2018-08-16T10:39:25+00:00'
|
||||||
uuid:
|
id:
|
||||||
description:
|
description:
|
||||||
- Unique UUID for this cluster
|
- Unique UUID for this cluster
|
||||||
type: str
|
type: str
|
||||||
@ -270,7 +270,13 @@ def main():
|
|||||||
else:
|
else:
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
module.exit_json(changed=changed, cluster=cluster, id=cluster['uuid'])
|
# NOTE (brtknr): At present, create_coe_cluster request returns
|
||||||
|
# cluster_id as `uuid` whereas get_coe_cluster request returns the
|
||||||
|
# same field as `id`. This behaviour may change in the future
|
||||||
|
# therefore try `id` first then `uuid`.
|
||||||
|
cluster_id = cluster.get('id', cluster.get('uuid'))
|
||||||
|
cluster['id'] = cluster['uuid'] = cluster_id
|
||||||
|
module.exit_json(changed=changed, cluster=cluster, id=cluster_id)
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
if not cluster:
|
if not cluster:
|
||||||
module.exit_json(changed=False)
|
module.exit_json(changed=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user