summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2022-05-25 15:58:15 -0500
committerTony Asleson <tasleson@redhat.com>2022-06-30 10:55:16 -0500
commitb3407b16c1c7b5bff01e3bde4e0f62a2608682f8 (patch)
tree6d575ff6c39ab2e218ef8def343d2f9599242806
parent58c6c9e9aa8d6aa6d3be14a04ec0f4257b61495e (diff)
downloadlvm2-b3407b16c1c7b5bff01e3bde4e0f62a2608682f8.tar.gz
lvmdbusd: re-work lvm shell main
Add an optional single argument "bisect" to use with git bisect for automation. Normal case is no arguments when running stand-alone.
-rw-r--r--daemons/lvmdbusd/lvm_shell_proxy.py.in46
1 files changed, 28 insertions, 18 deletions
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index 10719c67e..40639442c 100644
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -238,24 +238,34 @@ class LVMShellProxy(object):
if __name__ == "__main__":
- shell = LVMShellProxy()
- in_line = "start"
+ print("USING LVM BINARY: %s " % LVM_CMD)
+
try:
- while in_line:
- in_line = input("lvm> ")
- if in_line:
- start = time.time()
- ret, out, err = shell.call_lvm(in_line.split())
- end = time.time()
-
- print(("RC: %d" % ret))
- print(("OUT:\n%s" % out))
- print(("ERR:\n%s" % err))
-
- print("Command = %f seconds" % (end - start))
- except KeyboardInterrupt:
- pass
- except EOFError:
- pass
+ if len(sys.argv) > 1 and sys.argv[1] == "bisect":
+ shell = LVMShellProxy()
+ shell.exit_shell()
+ else:
+ shell = LVMShellProxy()
+ in_line = "start"
+ try:
+ while in_line:
+ in_line = input("lvm> ")
+ if in_line:
+ start = time.time()
+ ret, out, err = shell.call_lvm(in_line.split())
+ end = time.time()
+
+ print(("RC: %d" % ret))
+ print(("OUT:\n%s" % out))
+ print(("ERR:\n%s" % err))
+
+ print("Command = %f seconds" % (end - start))
+ except KeyboardInterrupt:
+ pass
+ except EOFError:
+ pass
except Exception:
traceback.print_exc(file=sys.stdout)
+ sys.exit(1)
+
+ sys.exit(0)