From 5a4940d1979370cb94191a82dcbdcaf94348156c Mon Sep 17 00:00:00 2001 From: Nijin Ashok Date: Fri, 8 Mar 2019 18:24:55 +0530 Subject: [PATCH] ovirt_vnic_profile: Fix issue in resetting the network filter (#53392) Currently, there is no way to reset the network profile of vNIC profiles to "No Network Filter". To reset the vNIC profile, we have to pass an None value to "types.NetworkFilter". The patch allows to reset it by passing empty string ('') to "network_filter". --- lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py b/lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py index 3c66bc924a..a04fd589c4 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py @@ -169,7 +169,7 @@ class EntityVnicPorfileModule(BaseModule): def __get_network_filter_id(self): nf_service = self._connection.system_service().network_filters_service() - return get_id_by_name(nf_service, self.param('network_filter')) + return get_id_by_name(nf_service, self.param('network_filter')) if self.param('network_filter') else None def build_entity(self): return otypes.VnicProfile( @@ -191,7 +191,7 @@ class EntityVnicPorfileModule(BaseModule): qos=otypes.Qos(id=self.__get_qos_id()) if self.param('qos') else None, network_filter=otypes.NetworkFilter(id=self.__get_network_filter_id()) - if self.param('network_filter') else None + if self.param('network_filter') is not None else None ) def update_check(self, entity): @@ -209,7 +209,7 @@ class EntityVnicPorfileModule(BaseModule): equal(self.param('migratable'), getattr(entity, 'migratable', None)) and equal(self.param('pass_through'), entity.pass_through.mode.name) and equal(self.param('description'), entity.description) and - equal(self.param('network_filter'), entity.network_filter.name) and + equal(self.param('network_filter'), getattr(entity.network_filter, 'name', None)) and equal(self.param('qos'), entity.qos.name) and equal(self.param('port_mirroring'), getattr(entity, 'port_mirroring', None)) )