From 9544166c4b5ca9dde783af7045dbfc717300a063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 26 Feb 2016 15:48:49 +0100 Subject: [PATCH] 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 --- dev/vagrant/newest_dhcp_lease.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/vagrant/newest_dhcp_lease.py b/dev/vagrant/newest_dhcp_lease.py index 1ade75bc4b..64a8e53da4 100644 --- a/dev/vagrant/newest_dhcp_lease.py +++ b/dev/vagrant/newest_dhcp_lease.py @@ -36,7 +36,7 @@ import xml.etree.ElementTree as etree import libvirt -class NoBridgeInterfaceException(Exception): +class NoPrivateDHCPInterfaceException(Exception): pass @@ -80,14 +80,14 @@ def get_mac_address(conn, domain_name): interfaces = devices.iterfind('interface') for interface in interfaces: - interface_type = interface.get('type') - if interface_type != 'bridge': + source = interface.find('source') + if source is None or source.get('network') != 'vagrant-private-dhcp': continue mac_element = interface.find('mac') mac_address = mac_element.get('address') return mac_address - raise NoBridgeInterfaceException() + raise NoPrivateDHCPInterfaceException() @libvirt_conn