Skip to content

Commit

Permalink
Fix ovirtvmipsv4 when using attr (#596)
Browse files Browse the repository at this point in the history
* Fix ovirtvmipsv4 when using attr

* add changelog
  • Loading branch information
mnecas authored Oct 6, 2022
1 parent efe985a commit 2cdb4fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/597-ovirt_disk-add-read_only-param.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Fix ovirtvmipsv4 when using attribute (https://github.com/oVirt/ovirt-ansible-collection/pull/596).
5 changes: 3 additions & 2 deletions plugins/filter/ovirtvmip.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def ovirtvmipv4(self, ovirt_vms, attr=None, network_ip=None):
def ovirtvmipsv4(self, ovirt_vms, attr=None, network_ip=None):
'Return list of IPv4 IPs'
ips = self._parse_ips(ovirt_vms, lambda version: version == 'v4', attr)
resp = [ip for ip in ips if self.__address_in_network(ip, network_ip)]
return resp
if attr:
return dict((k, v) for k, v in ips.items() if self.__address_in_network(v, network_ip))
return filter(lambda x: self.__address_in_network(x, network_ip), ips)

def ovirtvmipv6(self, ovirt_vms, attr=None, network_ip=None):
'Return first IPv6 IP'
Expand Down

0 comments on commit 2cdb4fc

Please sign in to comment.