summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py
diff options
context:
space:
mode:
authorNijin Ashok <nashok@redhat.com>2019-03-08 18:24:55 +0530
committeransibot <ansibot@users.noreply.github.com>2019-03-08 07:54:55 -0500
commit5a4940d1979370cb94191a82dcbdcaf94348156c (patch)
treea8f48e1bc4b6121336839fa63f4a54cc6b88d81b /lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py
parentd4bd01c7acaa380b0b011822684e8dbc4d1fb251 (diff)
downloadansible-5a4940d1979370cb94191a82dcbdcaf94348156c.tar.gz
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".
Diffstat (limited to 'lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py')
-rw-r--r--lib/ansible/modules/cloud/ovirt/ovirt_vnic_profile.py6
1 files 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))
)