diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2019-06-27 16:57:21 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-07-05 01:05:20 +0000 |
commit | ffdb0ca8b099ce638854dbb974093b2021f7ed50 (patch) | |
tree | 180dfbae39c6a2acbab509e7d48902d4e617c7a6 /source4 | |
parent | e5e4c113713ffbc88836db6cea0245a32151748f (diff) | |
download | samba-ffdb0ca8b099ce638854dbb974093b2021f7ed50.tar.gz |
s4/scripting/mymachinepw: print usage with bad arguments
Also, use sys.exit() function, not exit(), because sys.exit() reliably
exists.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rwxr-xr-x | source4/scripting/bin/mymachinepw | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/scripting/bin/mymachinepw b/source4/scripting/bin/mymachinepw index 921cd53bffc..5ad9c7e96dc 100755 --- a/source4/scripting/bin/mymachinepw +++ b/source4/scripting/bin/mymachinepw @@ -30,7 +30,8 @@ for o, v in optlist: if o == "-s": if not conf.load(v): print(v + " not found") - exit(1) + print("\nUsage: mymachinepw [-s SMBCONF]") + sys.exit(1) loaded = True if not loaded: @@ -50,9 +51,11 @@ if not msg: print("Error:") print("Password for host[%s] not found in path[%s]." % (netbios, path)) print("You may want to pass the smb.conf location via the -s option.") - exit(1) + print() + print("Usage: mymachinepw [-s SMBCONF]") + sys.exit(1) password=msg[0]['secret'][0] print(password) -exit(0) +sys.exit(0) |