SWDEV-446724 - Version command human readable output file format fix

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Change-Id: I94de5b03355b503ade307f2a3881acd07266d6c7
This commit is contained in:
Maisam Arif committed 2024-06-24 10:35:34 -05:00
1 parent 413c9ef6fe
commit 943c74b6ef
2 files changed
+10 -4

No files matched your search

+9 -3
Vedi File
@@ -115,9 +115,15 @@ class AMDSMICommands():
self.logger.output['rocm_version'] = f'{rocm_version_str}'
if self.logger.is_human_readable_format():
print(f'AMDSMI Tool: {__version__} | '\
f'AMDSMI Library version: {amdsmi_lib_version_str} | ' \
f'ROCm version: {rocm_version_str}')
human_readable_output = f"AMDSMI Tool: {__version__} | " \
f"AMDSMI Library version: {amdsmi_lib_version_str} | " \
f"ROCm version: {rocm_version_str}"
# Custom human readable handling for version
if self.logger.destination == 'stdout':
print(human_readable_output)
else:
with self.logger.destination.open('a') as output_file:
output_file.write(human_readable_output + '\n')
elif self.logger.is_json_format() or self.logger.is_csv_format():
self.logger.print_output()
+1 -1
Vedi File
@@ -465,7 +465,7 @@ class AMDSMILogger():
self._print_tabular_output(multiple_device_enabled=multiple_device_enabled, watching_output=watching_output)
else:
self._print_human_readable_output(multiple_device_enabled=multiple_device_enabled,
watching_output=watching_output)
watching_output=watching_output)
def _print_json_output(self, multiple_device_enabled=False, watching_output=False):