Skip to content

Commit

Permalink
When a fan is removed, show platform environment outputs empty or N/A…
Browse files Browse the repository at this point in the history
… values (#214)

* Display 'NOT PRESENT' for missing Fans

* Skip Status field when fan is absent and deleted redundant Status usage in Jinga file
  • Loading branch information
thaj-deen authored and GitHub Enterprise committed Nov 3, 2022
1 parent cc277fa commit ec3a68e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 6 additions & 4 deletions CLI/actioner/sonic-cli-pfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ def format_env_data(content):
else:
fan = {}
fan['Speed'] = sensor['speed']
if sensor['status'] == True:
fan['State'] = 'Normal'
else:
fan['State'] = 'Abnormal'
fan['Presence'] = sensor['presence']
if sensor['presence'] == True:
if sensor['status'] == True:
fan['State'] = 'Normal'
else:
fan['State'] = 'Abnormal'
if sensor['direction'] == 'exhaust':
fan['Airflow'] = 'Exhaust'
else:
Expand Down
12 changes: 8 additions & 4 deletions CLI/renderer/templates/platform_env_show.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ Fan Trays :
{% for name, fantray in json_output['Fan Trays'].items() %}
{{ name }} :
{% for id, fan in fantray.items() %}
{{id}} Speed : {{ fan['Speed'] }} RPM
{{id}} State : {{ fan['State'] }}
{{id}} Airflow : {{fan['Airflow'] }}
{% endfor %}
{% if fan['Presence'] != True %}
{{id}} : NOT PRESENT
{% else %}
{{id}} Speed : {{ fan['Speed'] }} RPM
{{id}} State : {{ fan['State'] }}
{{id}} Airflow : {{fan['Airflow']}}
{% endif %}
{% endfor %}
{% endfor %}

PSUs :
Expand Down

0 comments on commit ec3a68e

Please sign in to comment.