diff options
author | Steven Hardy <shardy@redhat.com> | 2015-01-22 12:41:02 +0000 |
---|---|---|
committer | Steven Hardy <shardy@redhat.com> | 2015-02-24 09:21:19 +0000 |
commit | 3d6c45c571503122741233a27a9e43c2fb56ecac (patch) | |
tree | fa16b388fdee042e63692d25f77c0d7d48e386f2 /os_net_config/__init__.py | |
parent | afed9e751c9eb70ea696436e07a535fc7c15783d (diff) |
Refactor ifup/ifdown into base-class
Refactor some common code so the base-class handles the ifup/down
Change-Id: Id1fee1d2d5c9315717611b7bf18f058c49fe3622
Diffstat (limited to 'os_net_config/__init__.py')
-rw-r--r-- | os_net_config/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/os_net_config/__init__.py b/os_net_config/__init__.py index 8d241af..5e1d091 100644 --- a/os_net_config/__init__.py +++ b/os_net_config/__init__.py @@ -117,3 +117,11 @@ class NetConfig(object): logger.info('%s%s' % (self.log_prefix, msg)) if not self.noop: os.remove(filename) + + def ifdown(self, interface, iftype='interface'): + msg = 'running ifdown on %s: %s' % (iftype, interface) + self.execute(msg, '/sbin/ifdown', interface, check_exit_code=False) + + def ifup(self, interface, iftype='interface'): + msg = 'running ifup on %s: %s' % (iftype, interface) + self.execute(msg, '/sbin/ifup', interface) |