@@ -74,7 +74,6 @@ def collect_data(self, args=None) -> tuple[TaskResult, Optional[DeviceEnumeratio
7474 On Linux, use lscpu and lspci
7575 On Windows, use WMI and hyper-v cmdlets
7676 """
77- device_enum = None
7877 if self .system_info .os_family == OSFamily .LINUX :
7978 # Count CPU sockets
8079 cpu_count_res = self ._run_sut_cmd (self .CMD_CPU_COUNT_LINUX )
@@ -91,31 +90,29 @@ def collect_data(self, args=None) -> tuple[TaskResult, Optional[DeviceEnumeratio
9190 cpu_count_res = self ._run_sut_cmd (self .CMD_CPU_COUNT_WINDOWS )
9291 gpu_count_res = self ._run_sut_cmd (self .CMD_GPU_COUNT_WINDOWS )
9392 vf_count_res = self ._run_sut_cmd (self .CMD_VF_COUNT_WINDOWS )
94- cpu_count , gpu_count , vf_count = [None , None , None ]
93+
94+ device_enum = DeviceEnumerationDataModel ()
9595
9696 if cpu_count_res .exit_code == 0 :
97- cpu_count = int (cpu_count_res .stdout )
97+ device_enum . cpu_count = int (cpu_count_res .stdout )
9898 else :
9999 self ._warning (description = "Cannot determine CPU count" , command = cpu_count_res )
100100
101101 if gpu_count_res .exit_code == 0 :
102- gpu_count = int (gpu_count_res .stdout )
102+ device_enum . gpu_count = int (gpu_count_res .stdout )
103103 else :
104104 self ._warning (description = "Cannot determine GPU count" , command = gpu_count_res )
105105
106106 if vf_count_res .exit_code == 0 :
107- vf_count = int (vf_count_res .stdout )
107+ device_enum . vf_count = int (vf_count_res .stdout )
108108 else :
109109 self ._warning (
110110 description = "Cannot determine VF count" ,
111111 command = vf_count_res ,
112112 category = EventCategory .SW_DRIVER ,
113113 )
114114
115- if cpu_count or gpu_count or vf_count :
116- device_enum = DeviceEnumerationDataModel (
117- cpu_count = cpu_count , gpu_count = gpu_count , vf_count = vf_count
118- )
115+ if device_enum .cpu_count or device_enum .gpu_count or device_enum .vf_count :
119116 self ._log_event (
120117 category = EventCategory .PLATFORM ,
121118 description = f"Counted { device_enum .cpu_count } CPUs, { device_enum .gpu_count } GPUs, { device_enum .vf_count } VFs" ,
@@ -124,6 +121,7 @@ def collect_data(self, args=None) -> tuple[TaskResult, Optional[DeviceEnumeratio
124121 )
125122 self .result .message = f"Device Enumeration: { device_enum .model_dump (exclude_none = True )} "
126123 self .result .status = ExecutionStatus .OK
124+ return self .result , device_enum
127125 else :
128126 self .result .message = "Device Enumeration info not found"
129127 self .result .status = ExecutionStatus .EXECUTION_FAILURE
@@ -132,5 +130,4 @@ def collect_data(self, args=None) -> tuple[TaskResult, Optional[DeviceEnumeratio
132130 description = self .result .message ,
133131 priority = EventPriority .CRITICAL ,
134132 )
135-
136- return self .result , device_enum
133+ return self .result , None
0 commit comments