Revert "Bug: if HP raidcard have no discs"
This commit is contained in:
parent
5f0aae6c01
commit
36ab9f22b4
1 changed files with 5 additions and 7 deletions
|
|
@ -10,6 +10,7 @@ REGEXP_CONTROLLER_HP = re.compile(r'Smart Array ([a-zA-Z0-9- ]+) in Slot ([0-9]+
|
||||||
class HPRaidControllerError(Exception):
|
class HPRaidControllerError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def ssacli(sub_command):
|
def ssacli(sub_command):
|
||||||
command = ["ssacli"]
|
command = ["ssacli"]
|
||||||
command.extend(sub_command.split())
|
command.extend(sub_command.split())
|
||||||
|
|
@ -20,19 +21,16 @@ def ssacli(sub_command):
|
||||||
)
|
)
|
||||||
p.wait()
|
p.wait()
|
||||||
stdout = p.stdout.read().decode("utf-8")
|
stdout = p.stdout.read().decode("utf-8")
|
||||||
if p.returncode == 1 and stdout.find('does not have any physical') == -1:
|
if p.returncode != 0:
|
||||||
mesg = "Failed to execute command '{}':\n{}".format(
|
mesg = "Failed to execute command '{}':\n{}".format(
|
||||||
" ".join(command), stdout
|
" ".join(command), stdout
|
||||||
)
|
)
|
||||||
raise HPRaidControllerError(mesg)
|
raise HPRaidControllerError(mesg)
|
||||||
else:
|
lines = stdout.split('\n')
|
||||||
if stdout.find('does not have any physical') != -1:
|
lines = list(filter(None, lines))
|
||||||
return list()
|
|
||||||
else:
|
|
||||||
lines = stdout.split('\n')
|
|
||||||
lines = list(filter(None, lines))
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|
||||||
def _parse_ctrl_output(lines):
|
def _parse_ctrl_output(lines):
|
||||||
controllers = {}
|
controllers = {}
|
||||||
current_ctrl = None
|
current_ctrl = None
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue