Skip to content

Commit d000770

Browse files
Jaspal SinghJaspal Singh
authored andcommitted
addressed review comments
1 parent 754c590 commit d000770

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

nodescraper/plugins/inband/journal/journal_collector.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
###############################################################################
2626
from typing import Optional
2727

28+
from pydantic import ValidationError
29+
2830
from nodescraper.base import InBandDataCollector
2931
from nodescraper.enums import EventCategory, EventPriority, ExecutionStatus, OSFamily
3032
from nodescraper.models import TaskResult
33+
from nodescraper.utils import get_exception_details
3134

3235
from .collector_args import JournalCollectorArgs
3336
from .journaldata import JournalData
@@ -55,15 +58,11 @@ def _read_with_journalctl(self, args: Optional[JournalCollectorArgs] = None):
5558

5659
res = self._run_sut_cmd(cmd, sudo=True, log_artifact=False, strip=False)
5760

58-
except Exception as exc:
59-
60-
import traceback
61-
62-
tb = traceback.format_exc()
61+
except ValidationError as val_err:
6362
self._log_event(
6463
category=EventCategory.OS,
6564
description="Exception while running journalctl",
66-
data={"command": cmd, "exception": str(exc), "traceback": tb},
65+
data=get_exception_details(val_err),
6766
priority=EventPriority.ERROR,
6867
console_log=True,
6968
)

0 commit comments

Comments
 (0)