Skip to content

Commit a8a83e9

Browse files
authored
[ssd] Allow individual vendor parsers to handle errors (#252)
Description Removed a return None in the command execution helper function _execute_shell in the SSD class so that command output is still parsed in the event of a non-zero exit code. Motivation and Context If there is an issue found with a SSD SMART utilities may return a non-zero error code and we would still want to parse the output so we should not bail. In addition, with the return None the parsing functions throw stack traces during execution. When removed, the parsing functions are able to elegantly handle missing information and the fields are left as N/A so there is no need for handling here. How Has This Been Tested? Tested manually on a SN2010 with a malfunctioning SSD which was initially throwing stack traces and now handles the error elegantly reporting the health as N/A a much more informative error than a python stack trace.
1 parent ee12215 commit a8a83e9

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

sonic_platform_base/sonic_ssd/ssd_generic.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ def __init__(self, diskdev):
6363
def _execute_shell(self, cmd):
6464
process = subprocess.Popen(cmd.split(), universal_newlines=True, stdout=subprocess.PIPE)
6565
output, error = process.communicate()
66-
exit_code = process.returncode
67-
if exit_code:
68-
return None
6966
return output
7067

7168
def _parse_re(self, pattern, buffer):

0 commit comments

Comments
 (0)