diff options
author | 2014-08-11 15:59:51 -0400 | |
---|---|---|
committer | 2014-08-11 15:59:51 -0400 | |
commit | 2da33853506c694684ced99675d6914053246b2a (patch) | |
tree | 6091799daa57cfca066285e40addfd4310296bab /os_net_config/cli.py | |
parent | 97f5eee7d135f462e82aa2c1ac9716971ad16ddc (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/cli.py')
-rw-r--r-- | os_net_config/cli.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/os_net_config/cli.py b/os_net_config/cli.py index 89ba3d0..0efc399 100644 --- a/os_net_config/cli.py +++ b/os_net_config/cli.py @@ -58,8 +58,8 @@ def parse_opts(argv): parser.add_argument('--version', action='version', version=os_net_config.__version__) parser.add_argument( - '-m', '--mock', - dest="mock", + '--noop', + dest="noop", action='store_true', help="Return the configuration commands, without applying them.", required=False) @@ -122,12 +122,13 @@ def main(argv=sys.argv): for iface_json in iface_array: obj = objects.object_from_json(iface_json) provider.addObject(obj) - if opts.mock: - res = provider.apply(mock=True) - print res - else: - provider.apply() - return 0 + files_changed = provider.apply(noop=opts.noop) + if opts.noop: + for location, data in files_changed.iteritems(): + print "File: %s\n" % location + print data + print "----" + return 0 if __name__ == '__main__': |