Skip to content

Conversation

@spilkey-cisco
Copy link

- What I did

Fixed possible snmp error if PSU data is not populated in state DB by pmon by the time snmp tries to retrieve the data.

- How I did it

Wrap the int conversion with a try-except block, and return 0 if the database did not contain a number in the psu_num field.

- How to verify it

Ensure exceptions like the following are not seen in syslog:

 #snmp-subagent [sonic_ax_impl] ERROR: PowerStatusHandler._get_psu_index() caught an unexpected exception during _get_num_psus()
 #012Traceback (most recent call last):
 #012  File "/usr/local/lib/python3.9/dist-packages/sonic_ax_impl/mibs/vendor/cisco/ciscoEntityFruControlMIB.py", line 101, in _get_psu_index
 #012    num_psus = self._get_num_psus()
 #012  File "/usr/local/lib/python3.9/dist-packages/sonic_ax_impl/mibs/vendor/cisco/ciscoEntityFruControlMIB.py", line 66, in _get_num_psus
 #012    return int(num_psus[0])
 #012ValueError: invalid literal for int() with base 10: ''

- Description for the changelog

Add default value for number of PSUs

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants