From 3d6c45c571503122741233a27a9e43c2fb56ecac Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Thu, 22 Jan 2015 12:41:02 +0000 Subject: Refactor ifup/ifdown into base-class Refactor some common code so the base-class handles the ifup/down Change-Id: Id1fee1d2d5c9315717611b7bf18f058c49fe3622 --- os_net_config/impl_ifcfg.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'os_net_config/impl_ifcfg.py') diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 56a0e47..100edeb 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -259,28 +259,24 @@ class IfcfgNetConfig(os_net_config.NetConfig): if ifcfg_file not in all_file_names: interface_name = ifcfg_file[len(cleanup_pattern()) - 1:] if interface_name != 'lo': - msg = 'cleaning up interface: %s' % interface_name - self.execute(msg, '/sbin/ifdown', interface_name, - check_exit_code=False) + logger.info('cleaning up interface: %s' + % interface_name) + self.ifdown(interface_name) self.remove_config(ifcfg_file) for interface in restart_interfaces: - msg = 'running ifdown on interface: %s' % interface - self.execute(msg, '/sbin/ifdown', interface, check_exit_code=False) + self.ifdown(interface) for bridge in restart_bridges: - msg = 'running ifdown on bridge: %s' % bridge - self.execute(msg, '/sbin/ifdown', bridge, check_exit_code=False) + self.ifdown(bridge, iftype='bridge') for location, data in update_files.iteritems(): self.write_config(location, data) for bridge in restart_bridges: - msg = 'running ifup on bridge: %s' % bridge - self.execute(msg, '/sbin/ifup', bridge) + self.ifup(bridge, iftype='bridge') for interface in restart_interfaces: - msg = 'running ifup on interface: %s' % interface - self.execute(msg, '/sbin/ifup', interface) + self.ifup(interface) return update_files -- cgit 1.2.3-korg