Handling bad status returns better.
This commit is contained in:
parent
4a952dc91f
commit
d4fcdd0282
@ -279,9 +279,12 @@ class DBRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
def status(self):
|
def status(self):
|
||||||
statuscmd = self._get_run_actions('status', excp.StatusException)
|
statuscmd = self._get_run_actions('status', excp.StatusException)
|
||||||
(sysout, stderr) = sh.execute(*statuscmd,
|
run_result = sh.execute(*statuscmd,
|
||||||
check_exit_code=False,
|
check_exit_code=False,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
|
if not run_result:
|
||||||
|
return comp.STATUS_UNKNOWN
|
||||||
|
(sysout, stderr) = run_result
|
||||||
combined = str(sysout) + str(stderr)
|
combined = str(sysout) + str(stderr)
|
||||||
combined = combined.lower()
|
combined = combined.lower()
|
||||||
if combined.find("running") != -1:
|
if combined.find("running") != -1:
|
||||||
|
@ -311,6 +311,8 @@ class HorizonRuntime(comp.EmptyRuntime):
|
|||||||
'cmd': APACHE_STATUS_CMD,
|
'cmd': APACHE_STATUS_CMD,
|
||||||
})
|
})
|
||||||
run_result = utils.execute_template(*cmds, params=mp, check_exit_code=False)
|
run_result = utils.execute_template(*cmds, params=mp, check_exit_code=False)
|
||||||
|
if not run_result or not run_result[0]:
|
||||||
|
return comp.STATUS_UNKNOWN
|
||||||
(sysout, stderr) = run_result[0]
|
(sysout, stderr) = run_result[0]
|
||||||
combined = str(sysout) + str(stderr)
|
combined = str(sysout) + str(stderr)
|
||||||
combined = combined.lower()
|
combined = combined.lower()
|
||||||
|
@ -102,9 +102,12 @@ class RabbitRuntime(comp.EmptyRuntime):
|
|||||||
def status(self):
|
def status(self):
|
||||||
#this has got to be the worst status output
|
#this has got to be the worst status output
|
||||||
#i have ever seen (its like a weird mix json+crap)
|
#i have ever seen (its like a weird mix json+crap)
|
||||||
(sysout, stderr) = sh.execute(*STATUS_CMD,
|
run_result = sh.execute(*STATUS_CMD,
|
||||||
check_exit_code=False,
|
check_exit_code=False,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
|
if not run_result:
|
||||||
|
return comp.STATUS_UNKNOWN
|
||||||
|
(sysout, stderr) = run_result
|
||||||
combined = str(sysout) + str(stderr)
|
combined = str(sysout) + str(stderr)
|
||||||
combined = combined.lower()
|
combined = combined.lower()
|
||||||
if combined.find('nodedown') != -1 or combined.find("unable to connect to node") != -1:
|
if combined.find('nodedown') != -1 or combined.find("unable to connect to node") != -1:
|
||||||
|
@ -79,6 +79,8 @@ def _status(distro):
|
|||||||
result = utils.execute_template(*cmds,
|
result = utils.execute_template(*cmds,
|
||||||
check_exit_code=False,
|
check_exit_code=False,
|
||||||
params=mp)
|
params=mp)
|
||||||
|
if not result or not result[0]:
|
||||||
|
return _DEAD
|
||||||
(sysout, stderr) = result[0]
|
(sysout, stderr) = result[0]
|
||||||
combined = str(sysout) + str(stderr)
|
combined = str(sysout) + str(stderr)
|
||||||
combined = combined.lower()
|
combined = combined.lower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user