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>
This commit is contained in:
Andy Grover
2013-10-28 14:50:39 -07:00
parent cc803f63bb
commit f2b98f1a9f

View File

@@ -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: