Skip to content

Commit 8ab3f29

Browse files
committed
skipping logging to file
1 parent b9cab6b commit 8ab3f29

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

nodescraper/plugins/inband/dmesg/dmesg_collector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ def collect_data(
155155
self._collect_dmesg_rotations()
156156

157157
if dmesg_content:
158-
dmesg_data = DmesgData(dmesg_content=dmesg_content)
158+
dmesg_data = DmesgData(
159+
dmesg_content=dmesg_content, skip_log_file=not args.collect_dmesg_log
160+
)
159161
self.result.message = "Dmesg data collected"
160162
return self.result, dmesg_data
161163

nodescraper/plugins/inband/dmesg/dmesgdata.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class DmesgData(DataModel):
3535
"""Data model for in band dmesg log"""
3636

3737
dmesg_content: str
38+
skip_log_file: bool = False
3839

3940
@classmethod
4041
def get_new_dmesg_lines(cls, current_dmesg: str, new_dmesg: str) -> str:
@@ -83,6 +84,8 @@ def log_model(self, log_path: str):
8384
Args:
8485
log_path (str): log path
8586
"""
87+
if self.skip_log_file:
88+
return
8689
log_name = os.path.join(log_path, get_unique_filename(log_path, "dmesg.log"))
8790
with open(log_name, "w", encoding="utf-8") as log_file:
8891
log_file.write(self.dmesg_content)

0 commit comments

Comments
 (0)