fix PSU power parsing (#74)
This commit is contained in:
parent
93c6444105
commit
4303312b17
1 changed files with 5 additions and 2 deletions
|
@ -20,7 +20,10 @@ class PowerSupply():
|
||||||
if 'Present' not in psu['Status']:
|
if 'Present' not in psu['Status']:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
max_power = psu.get('Max Power Capacity').split()[0]
|
try:
|
||||||
|
max_power = int(psu.get('Max Power Capacity').split()[0])
|
||||||
|
except ValueError:
|
||||||
|
max_power = None
|
||||||
desc = '{} - {}'.format(
|
desc = '{} - {}'.format(
|
||||||
psu.get('Manufacturer', 'No Manufacturer').strip(),
|
psu.get('Manufacturer', 'No Manufacturer').strip(),
|
||||||
psu.get('Name', 'No name').strip(),
|
psu.get('Name', 'No name').strip(),
|
||||||
|
@ -29,7 +32,7 @@ class PowerSupply():
|
||||||
'name': psu.get('Serial Number', 'No S/N').strip(),
|
'name': psu.get('Serial Number', 'No S/N').strip(),
|
||||||
'description': desc,
|
'description': desc,
|
||||||
'allocated_draw': None,
|
'allocated_draw': None,
|
||||||
'maximum_draw': int(max_power),
|
'maximum_draw': max_power,
|
||||||
'device': self.device_id,
|
'device': self.device_id,
|
||||||
})
|
})
|
||||||
return power_supply
|
return power_supply
|
||||||
|
|
Loading…
Add table
Reference in a new issue