257b6fe19e
- Bump leapp-framework to 4.0 - Improve the report summary output to make it more visible - Fix processing data in remediation instructions with non-ascii characters - Fix creation of Dialog for Component without choices - Store tracebacks from actors in leapp.db - Resolves: #2223312
60 lines
2.6 KiB
Diff
60 lines
2.6 KiB
Diff
From 486b4aae41d3d6d8f6f1ebe31e9c57dbe5ac3690 Mon Sep 17 00:00:00 2001
|
|
From: Inessa Vasilevskaya <ivasilev@redhat.com>
|
|
Date: Wed, 7 Jun 2023 13:53:38 +0200
|
|
Subject: [PATCH 15/18] Save actor tracebacks in leapp.db
|
|
|
|
Now when an exception is thrown during actor
|
|
execution it won't be shown only on stdout, but
|
|
will appear in leapp.db and leapp report as high
|
|
risk report message.
|
|
|
|
OAMG-4186
|
|
---
|
|
leapp/messaging/__init__.py | 7 ++++++-
|
|
leapp/workflows/__init__.py | 3 ++-
|
|
2 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/leapp/messaging/__init__.py b/leapp/messaging/__init__.py
|
|
index 9896179..de8ac9b 100644
|
|
--- a/leapp/messaging/__init__.py
|
|
+++ b/leapp/messaging/__init__.py
|
|
@@ -146,6 +146,11 @@ class BaseMessaging(object):
|
|
time=datetime.datetime.now())
|
|
self._do_produce(model, actor, self._errors)
|
|
|
|
+ def report_stacktrace(self, message, trace, actorname):
|
|
+ model = ErrorModel(message="{message}\n{trace}".format(message=message, trace=trace),
|
|
+ actor=actorname, severity="fatal", time=datetime.datetime.now())
|
|
+ self._do_produce(model, actorname, self._errors)
|
|
+
|
|
def request_stop_after_phase(self):
|
|
"""
|
|
If called, it will cause the workflow to stop the execution after the current phase ends.
|
|
@@ -222,7 +227,7 @@ class BaseMessaging(object):
|
|
data = json.dumps(model.dump(), sort_keys=True)
|
|
message = {
|
|
'type': type(model).__name__,
|
|
- 'actor': type(actor).name,
|
|
+ 'actor': type(actor).name if not isinstance(actor, str) else actor,
|
|
'topic': model.topic.name,
|
|
'stamp': datetime.datetime.utcnow().isoformat() + 'Z',
|
|
'phase': os.environ.get('LEAPP_CURRENT_PHASE', 'NON-WORKFLOW-EXECUTION'),
|
|
diff --git a/leapp/workflows/__init__.py b/leapp/workflows/__init__.py
|
|
index b909bb1..18cd8f2 100644
|
|
--- a/leapp/workflows/__init__.py
|
|
+++ b/leapp/workflows/__init__.py
|
|
@@ -338,8 +338,9 @@ class Workflow(with_metaclass(WorkflowMeta)):
|
|
config_model=config_model, skip_dialogs=skip_dialogs)
|
|
try:
|
|
instance.run()
|
|
- except BaseException:
|
|
+ except BaseException as exc:
|
|
self._unhandled_exception = True
|
|
+ messaging.report_stacktrace(message=exc.message, trace=exc.exception_info, actorname=actor.name)
|
|
raise
|
|
|
|
self._stop_after_phase_requested = messaging.stop_after_phase or self._stop_after_phase_requested
|
|
--
|
|
2.41.0
|
|
|