summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2013-10-28 14:50:39 -0700
committerAndy Grover <agrover@redhat.com>2013-10-28 14:50:39 -0700
commitf2b98f1a9f17d11c93b4cb093baff017a3419f9e (patch)
tree5bdb48e5749bf75523283829fa9c84c62c0d7ce3 /scripts
parentcc803f63bb06c8e38e8f44d7592fdba17477606e (diff)
downloadrtslib-fb-f2b98f1a9f17d11c93b4cb093baff017a3419f9e.tar.gz
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 <agrover@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/targetctl6
1 files changed, 5 insertions, 1 deletions
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: