[jenkins-ci PATCH 3/3] lcitool: add support for --debug / -d argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce a --debug / -d argument that allows the display of information
relevant to developers debugging problems. Initially this just displays
the top level exception catch, so that full stack traces are shown.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 guests/lcitool | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 2c86d07..d8a3aca 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -350,6 +350,9 @@ class Application:
             description="libvirt CI guest management tool",
         )
 
+        self._parser.add_argument("--debug", "-d", action="store_true",
+                                  help="display debugging information")
+
         subparsers = self._parser.add_subparsers(metavar="ACTION")
         subparsers.required = True
 
@@ -690,11 +693,14 @@ class Application:
 
     def run(self):
         args = self._parser.parse_args()
-        try:
+        if args.debug:
             args.func(args)
-        except Exception as err:
-            sys.stderr.write("{}: {}\n".format(sys.argv[0], err))
-            sys.exit(1)
+        else:
+            try:
+                args.func(args)
+            except Exception as err:
+                sys.stderr.write("{}: {}\n".format(sys.argv[0], err))
+                sys.exit(1)
 
 
 if __name__ == "__main__":
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux