Skip to content

Commit

Permalink
[psud] Fix issue where PSU Fan info is not updated in State DB (sonic…
Browse files Browse the repository at this point in the history
…-net#137)

- Initialize self.presence and other variables in PsuStatus dunder init to False instead of True.
- Import datetime module.
- Discussions related to this issue can be seen in sonic-net/sonic-platform-daemons#136
  • Loading branch information
aravindmani-1 authored Dec 28, 2020
1 parent e6c786b commit 81318f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sonic-psud/scripts/psud
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ try:
import signal
import sys
import threading

from datetime import datetime
from sonic_py_common import daemon_base, logger

# If unit testing is occurring, mock swsscommon and module_base
Expand Down Expand Up @@ -276,10 +276,10 @@ class PsuStatus(object):
def __init__(self, logger, psu):

self.psu = psu
self.presence = True
self.power_good = True
self.voltage_good = True
self.temperature_good = True
self.presence = False
self.power_good = False
self.voltage_good = False
self.temperature_good = False
self.logger = logger

def set_presence(self, presence):
Expand Down Expand Up @@ -548,7 +548,7 @@ class DaemonPsud(daemon_base.DaemonBase):
fan_name = try_get(fan.get_name, '{} FAN {}'.format(psu_name, index + 1))
direction = try_get(fan.get_direction) if presence else NOT_AVAILABLE
speed = try_get(fan.get_speed) if presence else NOT_AVAILABLE
status = UPDATING_STATUS if presence else NOT_AVAILABLE
status = "True" if presence else "False"
fvs = swsscommon.FieldValuePairs(
[(FAN_INFO_PRESENCE_FIELD, str(presence)),
(FAN_INFO_STATUS_FIELD, str(status)),
Expand Down

0 comments on commit 81318f7

Please sign in to comment.