diff options
author | Andy Grover <agrover@redhat.com> | 2014-02-13 11:01:26 -0800 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-02-13 11:01:26 -0800 |
commit | 9a8b2053bc323a766477a2c052ce39a90f87323b (patch) | |
tree | 5ea4dacccec4fe333d7c8f12bbcb6154c481c1fb | |
parent | 8bf74ac1cabd6f71a1ec57a941ee6007c90b1ca2 (diff) | |
download | rtslib-fb-9a8b2053bc323a766477a2c052ce39a90f87323b.tar.gz |
targetctl: A missing restore file is not an error
Also, fix whitespace.
Signed-off-by: Andy Grover <agrover@redhat.com>
-rwxr-xr-x | scripts/targetctl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/targetctl b/scripts/targetctl index bdf59f4..d0b8c5f 100755 --- a/scripts/targetctl +++ b/scripts/targetctl @@ -42,15 +42,20 @@ def save(to_file): RTSRoot().save_to_file(save_file=to_file) def restore(from_file): + + try: errors = RTSRoot().restore_from_file(restore_file=from_file) + except IOError: + # Not an error is the restore file is not present + sys.exit(0) - if errors: - print("Restore failed, %d errors:" % len(errors), file=err) + if errors: + print("Restore failed, %d errors:" % len(errors), file=err) - for error in errors: - print(error, file=err) + for error in errors: + print(error, file=err) - sys.exit(-1) + sys.exit(-1) def clear(unused): RTSRoot().clear_existing(confirm=True) |