From 462436fa4d339c80a888def1707f792c33cca715 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 14 Aug 2014 14:05:05 -0400 Subject: Add --cleanup, and impl for ifcfg Adds a new cleanup option which can be used to ifdown and remove interfaces that exists but aren't specified in the object model (or JSON). --- os_net_config/cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'os_net_config/cli.py') diff --git a/os_net_config/cli.py b/os_net_config/cli.py index 0efc399..5b6ff1d 100644 --- a/os_net_config/cli.py +++ b/os_net_config/cli.py @@ -64,6 +64,13 @@ def parse_opts(argv): help="Return the configuration commands, without applying them.", required=False) + parser.add_argument( + '--cleanup', + dest="cleanup", + action='store_true', + help="Cleanup unconfigured interfaces.", + required=False) + opts = parser.parse_args(argv[1:]) return opts @@ -122,7 +129,7 @@ def main(argv=sys.argv): for iface_json in iface_array: obj = objects.object_from_json(iface_json) provider.addObject(obj) - files_changed = provider.apply(noop=opts.noop) + files_changed = provider.apply(noop=opts.noop, cleanup=opts.cleanup) if opts.noop: for location, data in files_changed.iteritems(): print "File: %s\n" % location -- cgit 1.2.3-korg