From 8edb51939f74fb783c0f377d62c345f0694576c9 Mon Sep 17 00:00:00 2001 From: sgurumurthy Date: Mon, 14 Nov 2016 13:40:25 -0800 Subject: [PATCH] Closes-Bug: #1640064 Pass the macaddress to the interface_setup.py script if it is given as the inteface can get renamed after reboot Change-Id: I4f39dacbc4b88b4f512fba1323fd4fee86040699 --- src/server_mgr_main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server_mgr_main.py b/src/server_mgr_main.py index 2ef425cb..a331eb4f 100755 --- a/src/server_mgr_main.py +++ b/src/server_mgr_main.py @@ -3040,6 +3040,7 @@ def build_server_cfg(self, server): device_str = "#!/bin/bash\n" for intf in interface_list: name = intf['name'] + intf_name = name ip_addr = intf.get('ip_address', None) if ip_addr is None: continue @@ -3070,14 +3071,14 @@ def build_server_cfg(self, server): (name, " ".join(member_intfs), json.dumps(bond_opts), ip_addr) execute_script = True else: - #Take mac_address as the name only if the interface name is not specified - if 'name' not in intf and 'mac_address' in intf: + #Take the mac_address as the name as the interface may be renamed after reboot + if 'mac_address' in intf: name = intf['mac_address'].lower() if dhcp: device_str+= ("python /root/interface_setup.py --device %s --dhcp\n") %(name) else: #For static managment interface pass the default gateway - if (mgmt_intf == name) and d_gw: + if (mgmt_intf == intf_name) and d_gw: device_str+= ("python /root/interface_setup.py --device %s --ip %s --gw %s\n") % \ (name, ip_addr, d_gw) else: