summaryrefslogtreecommitdiffstats
path: root/os_net_config/cli.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-08-14 14:05:05 -0400
committerDan Prince <dprince@redhat.com>2014-08-14 14:05:05 -0400
commit462436fa4d339c80a888def1707f792c33cca715 (patch)
treec1e483e02de39f56062fa8531223b97de98c302f /os_net_config/cli.py
parent9e515950c7eb4a73e02a4f4883c223dd24ba93ff (diff)
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).
Diffstat (limited to 'os_net_config/cli.py')
-rw-r--r--os_net_config/cli.py9
1 files changed, 8 insertions, 1 deletions
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