From f2b98f1a9f17d11c93b4cb093baff017a3419f9e Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Mon, 28 Oct 2013 14:50:39 -0700 Subject: Add a 'clear' command to targetctl It seems like this might be useful. If restore has errors, it will result in a partially applied configuration. Maybe this what the user wants, or maybe they'd just as soon have no configuration if any part of it fails. If so, 'clear' to the rescue if exit status from 'restore' is nonzero. Signed-off-by: Andy Grover --- scripts/targetctl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/targetctl b/scripts/targetctl index 2871ad8..e65cbed 100755 --- a/scripts/targetctl +++ b/scripts/targetctl @@ -36,6 +36,7 @@ err = sys.stderr def usage(): print("syntax: %s save [file_to_save_to]" % sys.argv[0], file=err) print(" %s restore [file_to_restore_from]" % sys.argv[0], file=err) + print(" %s clear" % sys.argv[0], file=err) print(" default file is: %s" % default_save_file, file=err) sys.exit(-1) @@ -70,7 +71,10 @@ def restore(from_file): sys.exit(-1) -funcs = dict(save=save, restore=restore) +def clear(unused): + RTSRoot().clear_existing(confirm=True) + +funcs = dict(save=save, restore=restore, clear=clear) def main(): if os.geteuid() != 0: -- cgit v1.2.1