Fix log gathering

For DUTs without IP defined use host when creating log dir
(IP set to None caused an exception)
Use paramiko method for copying log files
(works when running tests from Windows)

Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
This commit is contained in:
Daniel Madej 2024-11-18 14:50:44 +01:00
parent a29e65f38d
commit eaabd446b8

View File

@ -199,12 +199,13 @@ class Log(HtmlLogManager, metaclass=Singleton):
TestRun.executor.run(f"dmesg > {log_files['dmesg.log']}") TestRun.executor.run(f"dmesg > {log_files['dmesg.log']}")
dut_identifier = TestRun.dut.ip if TestRun.dut.ip else TestRun.dut.config["host"]
for log_name, log_source_path in log_files.items(): for log_name, log_source_path in log_files.items():
try: try:
log_destination_path = os.path.join( log_destination_path = os.path.join(
self.base_dir, f"dut_info", TestRun.dut.ip, log_name self.base_dir, "dut_info", dut_identifier, log_name
) )
TestRun.executor.rsync_from(log_source_path, log_destination_path) TestRun.executor.copy_from(log_source_path, log_destination_path)
except Exception as e: except Exception as e:
TestRun.LOGGER.warning( TestRun.LOGGER.warning(
f"There was a problem during gathering {log_name} log.\n{str(e)}" f"There was a problem during gathering {log_name} log.\n{str(e)}"