diff options
| author | Andy Grover <agrover@redhat.com> | 2013-06-18 10:49:50 -0700 |
|---|---|---|
| committer | Andy Grover <agrover@redhat.com> | 2013-06-18 10:49:50 -0700 |
| commit | a221a535d718c3abbc53ee44713188d70db65a7d (patch) | |
| tree | 83a2bac4c5257e7e8dbe2c1eb8ec0076e92c387c | |
| parent | 0bccd534ee68cac9a8614be432f2f07ce5931d9e (diff) | |
| download | targetcli-a221a535d718c3abbc53ee44713188d70db65a7d.tar.gz | |
Catch module load errors
If targetcli is not run for the first time not as root, refresh() will
fail because it can't load modules. This returns a nicer error message
in that case.
See https://bugzilla.redhat.com/show_bug.cgi?id=973852
Signed-off-by: Andy Grover <agrover@redhat.com>
| -rwxr-xr-x | scripts/targetcli | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/targetcli b/scripts/targetcli index a2cbff1..269dc1a 100755 --- a/scripts/targetcli +++ b/scripts/targetcli @@ -64,8 +64,11 @@ def main(): try: root_node.refresh() - except RTSLibError, error: + except Exception, error: shell.con.display(shell.con.render_text(str(error), 'red')) + if not is_root: + shell.con.display(shell.con.render_text("Retry as root.", 'red')) + sys.exit(-1) if len(sys.argv) > 1: shell.run_cmdline(" ".join(sys.argv[1:])) |
