Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow data_dict to exclude drawer_name #3119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

justindthomas
Copy link

What I did

I adjusted fanshow to accommodate a missing drawer_name key in the data_dict.

How I did it

On my Dell N3248TE-ON, if only one of my PSUs is active, show platform fan generates a Python error due to a missing DRAWER_FIELD_NAME (set to drawer_name earlier) value in the data_dict that is built from the STATE_DB. I'm not sure if this is a peculiarity of the Dell unit or if it's more common. If I should adjust something in the Dell platform scripts instead, let me know.

How to verify it

show platform fan no longer generates a Python exception when only one PSU is active.

Previous command output (if the output of a command-line utility has changed)

root@sonic:~# show platform fan
Traceback (most recent call last):
  File "/usr/local/bin/fanshow", line 85, in <module>
    fanShow.show()
  File "/usr/local/bin/fanshow", line 75, in show
    table.append((data_dict[DRAWER_FIELD_NAME], data_dict[LED_STATUS_FIELD_NAME], name, speed, data_dict[DIRECTION_FIELD_NAME], presence, status,
KeyError: 'drawer_name'

New command output (if the output of a command-line utility has changed)

jdt@sonic:~$ show platform fan
  Drawer    LED            FAN    Speed    Direction    Presence    Status          Timestamp
--------  -----  -------------  -------  -----------  ----------  --------  -----------------
FanTray1    N/A  FanTray1-Fan1      32%       intake     Present        OK  20240112 01:40:13
FanTray2    N/A  FanTray2-Fan1      37%       intake     Present        OK  20240112 01:40:13
FanTray3    N/A  FanTray3-Fan1      34%       intake     Present        OK  20240112 01:40:13
     N/A    N/A       PSU1 Fan      N/A          N/A     Present        OK  20240112 01:40:11
     N/A    N/A       PSU2 Fan      19%       intake     Present        OK  20240112 01:40:14

It seems like maybe more work is required on this since Status should probably not say OK. But at least it doesn't throw an exception now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant