Fixed it so that db/apache/rabbit now counts the unrecognized service as stopped which helps handle failures better, also fixed the progress bar, coloring seems to make the bars offsets wrong, so turning off coloring.

This commit is contained in:
Joshua Harlow 2012-03-17 01:51:25 -07:00
parent 2b7d461abb
commit 419686f229
5 changed files with 12 additions and 7 deletions

View File

@ -53,8 +53,8 @@ RUNNER_CLS_MAPPING = {
BASE_LINK_DIR = "/etc"
# Progress bar titles
UNINSTALL_TITLE = utils.color_text('Uninstalling', 'blue')
INSTALL_TITLE = utils.color_text('Installing', 'blue')
UNINSTALL_TITLE = 'Uninstalling'
INSTALL_TITLE = 'Installing'
class ComponentBase(object):

View File

@ -211,7 +211,8 @@ class DBRuntime(comp.EmptyRuntime):
combined = combined.lower()
if combined.find("running") != -1:
return comp.STATUS_STARTED
elif combined.find("stop") != -1:
elif combined.find("stop") != -1 or \
combined.find('unrecognized') != -1:
return comp.STATUS_STOPPED
else:
return comp.STATUS_UNKNOWN

View File

@ -235,9 +235,11 @@ class HorizonRuntime(comp.EmptyRuntime):
(sysout, stderr) = run_result[0]
combined = str(sysout) + str(stderr)
combined = combined.lower()
if sysout.find("is running") != -1:
if combined.find("is running") != -1:
return comp.STATUS_STARTED
elif sysout.find("not running") != -1 or sysout.find("stopped") != -1:
elif combined.find("not running") != -1 or \
combined.find("stopped") != -1 or \
combined.find('unrecognized') != -1:
return comp.STATUS_STOPPED
else:
return comp.STATUS_UNKNOWN

View File

@ -105,7 +105,9 @@ class RabbitRuntime(comp.EmptyRuntime):
(sysout, stderr) = run_result
combined = str(sysout) + str(stderr)
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 or \
combined.find('unrecognized') != -1:
return comp.STATUS_STOPPED
elif combined.find('running_applications') != -1:
return comp.STATUS_STARTED

View File

@ -145,7 +145,7 @@ def to_bytes(text):
@contextlib.contextmanager
def progress_bar(name, max_am):
widgets = [
' %s: ' % (name), progressbar.Percentage(),
'%s: ' % (name), progressbar.Percentage(),
' ', progressbar.Bar(),
' ', progressbar.ETA(),
]