From d6b564966ff64686fb30410d29fc8afb876d335b Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Fri, 20 Oct 2017 11:42:26 +0200 Subject: [PATCH] ovirt_host_networks: Fix label assignment (#31969) --- lib/ansible/modules/cloud/ovirt/ovirt_host_networks.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_host_networks.py b/lib/ansible/modules/cloud/ovirt/ovirt_host_networks.py index 781db1cee37..75c9abc7512 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_host_networks.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_host_networks.py @@ -194,6 +194,7 @@ class HostNetworksModule(BaseModule): update = False bond = self._module.params['bond'] networks = self._module.params['networks'] + labels = self._module.params['labels'] nic = get_entity(nic_service) if nic is None: @@ -209,6 +210,12 @@ class HostNetworksModule(BaseModule): ) ) + # Check if labels need to be updated on interface/bond: + if labels: + net_labels = nic_service.network_labels_service().list() + if sorted(labels) != sorted([lbl.id for lbl in net_labels]): + return True + if not networks: return update @@ -307,7 +314,7 @@ def main(): ] if bond else None, modified_labels=[ otypes.NetworkLabel( - name=str(name), + id=str(name), host_nic=otypes.HostNic( name=bond.get('name') if bond else interface ),