diff options
author | 2015-01-22 11:33:38 +0000 | |
---|---|---|
committer | 2015-02-24 09:20:55 +0000 | |
commit | 70c235d30aee3a401414f622b3de4f09f4b3d180 (patch) | |
tree | 323c5f65cfa02701ef2ae208e917e3e06a434e2e /os_net_config/cli.py | |
parent | a4ad189558a414c6029b4dfbc8e459339ebe534d (diff) |
Move noop flag to provider base-class
Moving this flag makes it easier to implement additional functions
which work differently depending on noop mode being set, vs passing
it into every function like apply()
Change-Id: I796792aece3e40322523e910a3b87f7ab9a451dd
Diffstat (limited to 'os_net_config/cli.py')
-rw-r--r-- | os_net_config/cli.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/os_net_config/cli.py b/os_net_config/cli.py index 939eeaa..955bb6f 100644 --- a/os_net_config/cli.py +++ b/os_net_config/cli.py @@ -112,19 +112,19 @@ def main(argv=sys.argv): provider = None if opts.provider: if opts.provider == 'ifcfg': - provider = impl_ifcfg.IfcfgNetConfig() + provider = impl_ifcfg.IfcfgNetConfig(noop=opts.noop) elif opts.provider == 'eni': - provider = impl_eni.ENINetConfig() + provider = impl_eni.ENINetConfig(noop=opts.noop) elif opts.provider == 'iproute': - provider = impl_iproute.IPRouteNetConfig() + provider = impl_iproute.IPRouteNetConfig(noop=opts.noop) else: logger.error('Invalid provider specified.') return 1 else: if os.path.exists('/etc/sysconfig/network-scripts/'): - provider = impl_ifcfg.IfcfgNetConfig() + provider = impl_ifcfg.IfcfgNetConfig(noop=opts.noop) elif os.path.exists('/etc/network/'): - provider = impl_eni.ENINetConfig() + provider = impl_eni.ENINetConfig(noop=opts.noop) else: logger.error('Unable to set provider for this operating system.') return 1 @@ -161,7 +161,7 @@ def main(argv=sys.argv): iface_json.update({'persist_mapping': persist_mapping}) obj = objects.object_from_json(iface_json) provider.add_object(obj) - files_changed = provider.apply(noop=opts.noop, cleanup=opts.cleanup) + files_changed = provider.apply(cleanup=opts.cleanup) if opts.noop: for location, data in files_changed.iteritems(): print "File: %s\n" % location |