mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add DHCP leases to the facts return by the module (#19700)
On RHEL 6, where the feature is not present, this will be ignored and return nothing.
This commit is contained in:
parent
eeebd51f21
commit
6221327b13
1 changed files with 9 additions and 0 deletions
|
@ -369,6 +369,10 @@ class LibvirtConnection(object):
|
||||||
state = self.find_entry(entryid).isPersistent()
|
state = self.find_entry(entryid).isPersistent()
|
||||||
return ENTRY_STATE_PERSISTENT_MAP.get(state,"unknown")
|
return ENTRY_STATE_PERSISTENT_MAP.get(state,"unknown")
|
||||||
|
|
||||||
|
def get_dhcp_leases(self, entryid):
|
||||||
|
network = self.find_entry(entryid)
|
||||||
|
return network.DHCPLeases()
|
||||||
|
|
||||||
def define_from_xml(self, entryid, xml):
|
def define_from_xml(self, entryid, xml):
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
return self.conn.networkDefineXML(xml)
|
return self.conn.networkDefineXML(xml)
|
||||||
|
@ -454,6 +458,11 @@ class VirtNetwork(object):
|
||||||
results[entry]["state"] = self.conn.get_status(entry)
|
results[entry]["state"] = self.conn.get_status(entry)
|
||||||
results[entry]["bridge"] = self.conn.get_bridge(entry)
|
results[entry]["bridge"] = self.conn.get_bridge(entry)
|
||||||
results[entry]["uuid"] = self.conn.get_uuid(entry)
|
results[entry]["uuid"] = self.conn.get_uuid(entry)
|
||||||
|
try:
|
||||||
|
results[entry]["dhcp_leases"] = self.conn.get_dhcp_leases(entry)
|
||||||
|
# not supported on RHEL 6
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
results[entry]["forward_mode"] = self.conn.get_forward(entry)
|
results[entry]["forward_mode"] = self.conn.get_forward(entry)
|
||||||
|
|
Loading…
Reference in a new issue