Fix issue in newest_dhcp_lease.py
This fixes a bug in newest_dhcp_lease.py where the get_mac_address function currently searches for a "bridge" interface instead of searching for the interface whose source network is "vagrant-private-dhcp". Change-Id: Iea0b25f893b959b5e319b117e7a1c4c63a00dd23 Closes-Bug: #1548742
This commit is contained in:
parent
287e4faf99
commit
9544166c4b
@ -36,7 +36,7 @@ import xml.etree.ElementTree as etree
|
|||||||
import libvirt
|
import libvirt
|
||||||
|
|
||||||
|
|
||||||
class NoBridgeInterfaceException(Exception):
|
class NoPrivateDHCPInterfaceException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -80,14 +80,14 @@ def get_mac_address(conn, domain_name):
|
|||||||
interfaces = devices.iterfind('interface')
|
interfaces = devices.iterfind('interface')
|
||||||
|
|
||||||
for interface in interfaces:
|
for interface in interfaces:
|
||||||
interface_type = interface.get('type')
|
source = interface.find('source')
|
||||||
if interface_type != 'bridge':
|
if source is None or source.get('network') != 'vagrant-private-dhcp':
|
||||||
continue
|
continue
|
||||||
mac_element = interface.find('mac')
|
mac_element = interface.find('mac')
|
||||||
mac_address = mac_element.get('address')
|
mac_address = mac_element.get('address')
|
||||||
return mac_address
|
return mac_address
|
||||||
|
|
||||||
raise NoBridgeInterfaceException()
|
raise NoPrivateDHCPInterfaceException()
|
||||||
|
|
||||||
|
|
||||||
@libvirt_conn
|
@libvirt_conn
|
||||||
|
Loading…
Reference in New Issue
Block a user