]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
library/jenkins_node: improve diagnostics on failure. 2147/head
authorDan Mick <dmick@redhat.com>
Sat, 15 Jul 2023 01:09:08 +0000 (18:09 -0700)
committerDan Mick <dmick@redhat.com>
Sat, 15 Jul 2023 01:10:04 +0000 (18:10 -0700)
Capture exception args for exceptions that have no msg or message,
and capture a traceback.

Signed-off-by: Dan Mick <dmick@redhat.com>
ansible/library/jenkins_node

index 792a027cf979a2dd3cbbad3c7292d130038eb947..e20c9d2ce7004c729ee3090e094f411ad1963000 100644 (file)
@@ -101,6 +101,7 @@ EXAMPLES = """
            name={{ node_name }} operation=delete
 """
 import ast
+import traceback
 import xmltodict
 
 HAS_JENKINS_API = True
@@ -299,7 +300,9 @@ def main():
         else:
             message = getattr(ex, 'message', None)
             msg = getattr(ex, 'msg', message)
-            msg = "%s: %s" % (ex.__class__.__name__, msg)
+            if not msg:
+                msg = str(ex)
+            msg = "%s: %s\n%s" % (ex.__class__.__name__, msg, traceback.format_tb(ex.__traceback__))
         return module.fail_json(msg=msg)
 
     args = {'changed': changed}