aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_ifcfg.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-08-15 09:53:58 -0400
committerDan Prince <dprince@redhat.com>2014-08-15 09:53:58 -0400
commit2d3af95651223ca142e99c9c2bbe284481e3f33d (patch)
tree61cadb5f6c8263d7c4a09ad120947bde76a0be4a /os_net_config/impl_ifcfg.py
parent79c82ffcf8aee74a607ea269ef6baa67c85369d6 (diff)
ifcfg: Exclude ifcfg-lo from cleanup
This interface should always exist... we don't want to clean it up.
Diffstat (limited to 'os_net_config/impl_ifcfg.py')
-rw-r--r--os_net_config/impl_ifcfg.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py
index aa69cb4..f603054 100644
--- a/os_net_config/impl_ifcfg.py
+++ b/os_net_config/impl_ifcfg.py
@@ -238,11 +238,13 @@ class IfcfgNetConfig(os_net_config.NetConfig):
if cleanup:
for ifcfg_file in glob.iglob(cleanup_pattern()):
if ifcfg_file not in all_file_names:
- interface_name = ifcfg_file[37:]
- logger.info('cleaning up interface: %s' % interface_name)
- processutils.execute('/sbin/ifdown', interface_name,
- check_exit_code=False)
- os.remove(ifcfg_file)
+ interface_name = ifcfg_file[len(cleanup_pattern()) - 1:]
+ if interface_name != 'lo':
+ logger.info('cleaning up interface: %s' %
+ interface_name)
+ processutils.execute('/sbin/ifdown', interface_name,
+ check_exit_code=False)
+ os.remove(ifcfg_file)
for interface in restart_interfaces:
logger.info('running ifdown on interface: %s' % interface)