Merge pull request #220 from cyrinux/fix/hp-raid

fix: hp raid, prevent us to miss some errors
This commit is contained in:
Cyril Levis 2022-04-06 09:25:56 +02:00 committed by GitHub
commit 6181800cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,13 +20,13 @@ def ssacli(sub_command):
)
p.wait()
stdout = p.stdout.read().decode("utf-8")
if p.returncode == 1 and stdout.find('does not have any physical') == -1:
if p.returncode != 0 and 'does not have any physical' not in stdout:
mesg = "Failed to execute command '{}':\n{}".format(
" ".join(command), stdout
)
raise HPRaidControllerError(mesg)
else:
if stdout.find('does not have any physical') != -1:
if 'does not have any physical' in stdout:
return list()
else:
lines = stdout.split('\n')