From 6f903b73a6ea6d71d0deb4556de65b69901b9f6d Mon Sep 17 00:00:00 2001 From: Andrew McLeod Date: Thu, 26 Sep 2019 13:59:59 +0200 Subject: [PATCH] fix interface and mac address matching --- zaza/openstack/utilities/openstack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 94e86a8..e966716 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -502,11 +502,11 @@ def add_interface_to_netplan(server_name, mac_address, dvr_mode=None): unit_name = juju_utils.get_unit_name_from_host_name( server_name, application_name) - run_cmd_nic = "ip addr|grep {} -B1".format(mac_address) + run_cmd_nic = "ip -f link -br -o addr|grep {}".format(mac_address) interface = model.run_on_unit(unit_name, run_cmd_nic) - interface = interface['Stdout'].split(' ')[1].replace(':', '') + interface = interface['Stdout'].split(' ')[0] - run_cmd_netplan = """sudo egrep -iR '{}|{}' /etc/netplan/ + run_cmd_netplan = """sudo egrep -iR '{}|{}$' /etc/netplan/ """.format(mac_address, interface) netplancfg = model.run_on_unit(unit_name, run_cmd_netplan)