|
25 | 25 | ############################################################################### |
26 | 26 | from typing import Optional |
27 | 27 |
|
| 28 | +from pydantic import ValidationError |
| 29 | + |
28 | 30 | from nodescraper.base import InBandDataCollector |
29 | 31 | from nodescraper.enums import EventCategory, EventPriority, ExecutionStatus, OSFamily |
30 | 32 | from nodescraper.models import TaskResult |
| 33 | +from nodescraper.utils import get_exception_details |
31 | 34 |
|
32 | 35 | from .collector_args import JournalCollectorArgs |
33 | 36 | from .journaldata import JournalData |
@@ -55,15 +58,11 @@ def _read_with_journalctl(self, args: Optional[JournalCollectorArgs] = None): |
55 | 58 |
|
56 | 59 | res = self._run_sut_cmd(cmd, sudo=True, log_artifact=False, strip=False) |
57 | 60 |
|
58 | | - except Exception as exc: |
59 | | - |
60 | | - import traceback |
61 | | - |
62 | | - tb = traceback.format_exc() |
| 61 | + except ValidationError as val_err: |
63 | 62 | self._log_event( |
64 | 63 | category=EventCategory.OS, |
65 | 64 | description="Exception while running journalctl", |
66 | | - data={"command": cmd, "exception": str(exc), "traceback": tb}, |
| 65 | + data=get_exception_details(val_err), |
67 | 66 | priority=EventPriority.ERROR, |
68 | 67 | console_log=True, |
69 | 68 | ) |
|
0 commit comments