@@ -305,7 +305,7 @@ class PsuStatus(object):
305
305
return True
306
306
307
307
def set_voltage (self , voltage , high_threshold , low_threshold ):
308
- if not voltage or not high_threshold or not low_threshold :
308
+ if voltage == NOT_AVAILABLE or high_threshold == NOT_AVAILABLE or low_threshold == NOT_AVAILABLE :
309
309
if self .voltage_good is not True :
310
310
self .logger .log_warning ('PSU voltage or high_threshold or low_threshold become unavailable, '
311
311
'voltage={}, high_threshold={}, low_threshold={}' .format (voltage , high_threshold , low_threshold ))
@@ -320,7 +320,7 @@ class PsuStatus(object):
320
320
return True
321
321
322
322
def set_temperature (self , temperature , high_threshold ):
323
- if not temperature or not high_threshold :
323
+ if temperature == NOT_AVAILABLE or high_threshold == NOT_AVAILABLE :
324
324
if self .temperature_good is not True :
325
325
self .logger .log_warning ('PSU temperature or high_threshold become unavailable, '
326
326
'temperature={}, high_threshold={}' .format (temperature , high_threshold ))
@@ -445,23 +445,23 @@ class DaemonPsud(daemon_base.DaemonBase):
445
445
name = get_psu_key (index )
446
446
presence = _wrapper_get_psu_presence (index )
447
447
power_good = False
448
- voltage = None
449
- voltage_high_threshold = None
450
- voltage_low_threshold = None
451
- temperature = None
452
- temperature_threshold = None
453
- current = None
454
- power = None
448
+ voltage = NOT_AVAILABLE
449
+ voltage_high_threshold = NOT_AVAILABLE
450
+ voltage_low_threshold = NOT_AVAILABLE
451
+ temperature = NOT_AVAILABLE
452
+ temperature_threshold = NOT_AVAILABLE
453
+ current = NOT_AVAILABLE
454
+ power = NOT_AVAILABLE
455
455
is_replaceable = try_get (psu .is_replaceable , False )
456
456
if presence :
457
457
power_good = _wrapper_get_psu_status (index )
458
- voltage = try_get (psu .get_voltage )
459
- voltage_high_threshold = try_get (psu .get_voltage_high_threshold )
460
- voltage_low_threshold = try_get (psu .get_voltage_low_threshold )
461
- temperature = try_get (psu .get_temperature )
462
- temperature_threshold = try_get (psu .get_temperature_high_threshold )
463
- current = try_get (psu .get_current )
464
- power = try_get (psu .get_power )
458
+ voltage = try_get (psu .get_voltage , NOT_AVAILABLE )
459
+ voltage_high_threshold = try_get (psu .get_voltage_high_threshold , NOT_AVAILABLE )
460
+ voltage_low_threshold = try_get (psu .get_voltage_low_threshold , NOT_AVAILABLE )
461
+ temperature = try_get (psu .get_temperature , NOT_AVAILABLE )
462
+ temperature_threshold = try_get (psu .get_temperature_high_threshold , NOT_AVAILABLE )
463
+ current = try_get (psu .get_current , NOT_AVAILABLE )
464
+ power = try_get (psu .get_power , NOT_AVAILABLE )
465
465
466
466
if index not in self .psu_status_dict :
467
467
self .psu_status_dict [index ] = PsuStatus (self , psu )
@@ -508,8 +508,8 @@ class DaemonPsud(daemon_base.DaemonBase):
508
508
self ._set_psu_led (psu , psu_status )
509
509
510
510
fvs = swsscommon .FieldValuePairs (
511
- [(PSU_INFO_MODEL_FIELD , str (try_get (psu .get_model ))),
512
- (PSU_INFO_SERIAL_FIELD , str (try_get (psu .get_serial ))),
511
+ [(PSU_INFO_MODEL_FIELD , str (try_get (psu .get_model , NOT_AVAILABLE ))),
512
+ (PSU_INFO_SERIAL_FIELD , str (try_get (psu .get_serial , NOT_AVAILABLE ))),
513
513
(PSU_INFO_TEMP_FIELD , str (temperature )),
514
514
(PSU_INFO_TEMP_TH_FIELD , str (temperature_threshold )),
515
515
(PSU_INFO_VOLTAGE_FIELD , str (voltage )),
0 commit comments