aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_eni.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-08-11 15:59:51 -0400
committerDan Prince <dprince@redhat.com>2014-08-11 15:59:51 -0400
commit2da33853506c694684ced99675d6914053246b2a (patch)
tree6091799daa57cfca066285e40addfd4310296bab /os_net_config/impl_eni.py
parent97f5eee7d135f462e82aa2c1ac9716971ad16ddc (diff)
Use --noop instead of --mock.
Updates the apply() function for each NetConfig object so that it now accepts noop instead. Also, the updated files are not returned (always instead of conditionally if mock was used).
Diffstat (limited to 'os_net_config/impl_eni.py')
-rw-r--r--os_net_config/impl_eni.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/os_net_config/impl_eni.py b/os_net_config/impl_eni.py
index 0df8b15..c32fc82 100644
--- a/os_net_config/impl_eni.py
+++ b/os_net_config/impl_eni.py
@@ -159,7 +159,14 @@ class ENINetConfig(os_net_config.NetConfig):
self.routes[interface_name] = data
logger.debug('route data: %s' % self.routes[interface_name])
- def apply(self, mock=False):
+ def apply(self, noop=False):
+ """Apply the network configuration.
+
+ :param noop: A boolean which indicates whether this is a no-op.
+ :returns: a dict of the format: filename/data which contains info
+ for each file that was changed (or would be changed if in --noop
+ mode).
+ """
new_config = ""
# write out bridges first. This ensures that an ifup -a
@@ -175,8 +182,8 @@ class ENINetConfig(os_net_config.NetConfig):
new_config += iface_data
if (utils.diff(_network_config_path(), new_config)):
- if mock:
- return new_config
+ if noop:
+ return {"/etc/network/interfaces", new_config}
for interface in self.interfaces.keys():
logger.info('running ifdown on interface: %s' % interface)
processutils.execute('/sbin/ifdown', interface,