aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_eni.py
diff options
context:
space:
mode:
authormarios <marios@redhat.com>2014-08-01 17:21:35 +0300
committerDan Prince <dprince@redhat.com>2014-08-11 15:50:52 -0400
commit97f5eee7d135f462e82aa2c1ac9716971ad16ddc (patch)
tree72bfeb7cb8991afe5581750548c67359d3e694f6 /os_net_config/impl_eni.py
parent2a2a50221559d81958ae309d193ab0e18602d268 (diff)
Adds mock ability to the ENI and Ifcfg providers
Specifying mock=True for 'apply' will return a string representing the changes required, or commands to be used in order to implement the requested/specified configuration. This is also exposed to the cli, with -m (--mock), e.g. os-net-config --mock -c ./etc/example_os_net_config_1.json -p eni
Diffstat (limited to 'os_net_config/impl_eni.py')
-rw-r--r--os_net_config/impl_eni.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/os_net_config/impl_eni.py b/os_net_config/impl_eni.py
index f652c91..0df8b15 100644
--- a/os_net_config/impl_eni.py
+++ b/os_net_config/impl_eni.py
@@ -159,7 +159,7 @@ class ENINetConfig(os_net_config.NetConfig):
self.routes[interface_name] = data
logger.debug('route data: %s' % self.routes[interface_name])
- def apply(self):
+ def apply(self, mock=False):
new_config = ""
# write out bridges first. This ensures that an ifup -a
@@ -175,6 +175,8 @@ class ENINetConfig(os_net_config.NetConfig):
new_config += iface_data
if (utils.diff(_network_config_path(), new_config)):
+ if mock:
+ return new_config
for interface in self.interfaces.keys():
logger.info('running ifdown on interface: %s' % interface)
processutils.execute('/sbin/ifdown', interface,