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: