From ff0285c6c44d14c7c41639e43e836b30675d5ce9 Mon Sep 17 00:00:00 2001 From: Nijin Ashok Date: Tue, 5 Mar 2019 19:10:15 +0530 Subject: [PATCH] ovirt_network: Fix update_check for cluster network role (#53318) Currently if we didn't specify the "role" in the task which is already available for the network, the update_check will return FALSE. The patch fixes the same and update_check will only return FALSE if there is any additonal role specified for the network that are not currently available for the network. --- lib/ansible/modules/cloud/ovirt/ovirt_network.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_network.py b/lib/ansible/modules/cloud/ovirt/ovirt_network.py index d80972859e9..0bb7466f9f0 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_network.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_network.py @@ -241,18 +241,18 @@ class ClusterNetworksModule(BaseModule): return ( equal(self._cluster_network.get('required'), entity.required) and equal(self._cluster_network.get('display'), entity.display) and - equal( - sorted([ - usage - for usage in ['display', 'gluster', 'migration'] - if self._cluster_network.get(usage, False) - ]), - sorted([ + all( + x in [ str(usage) for usage in getattr(entity, 'usages', []) # VM + MANAGEMENT is part of root network if usage != otypes.NetworkUsage.VM and usage != otypes.NetworkUsage.MANAGEMENT - ]), + ] + for x in [ + usage + for usage in ['display', 'gluster', 'migration'] + if self._cluster_network.get(usage, False) + ] ) )