You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9 KiB

From 6d0ad276260c902dba66df73beac1bafc3f4c254 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Wed, 25 May 2022 15:58:15 -0500
Subject: [PATCH 3/9] 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.
(cherry picked from commit b3407b16c1c7b5bff01e3bde4e0f62a2608682f8)
---
daemons/lvmdbusd/lvm_shell_proxy.py.in | 46 ++++++++++++++++----------
1 file 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)
--
2.37.1