Another update to component descriptions + colored text output bolding.
This commit is contained in:
@@ -197,19 +197,16 @@ def create_db(cfg, dbname):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the database component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "N/A"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [DBRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the db component."
|
||||||
DBInstaller.__name__,
|
out = description.format(**params)
|
||||||
DBUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -174,19 +174,16 @@ class GlanceInstaller(comp.PythonInstallComponent):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the glance component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [GlanceRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the glance component."
|
||||||
GlanceInstaller.__name__,
|
out = description.format(**params)
|
||||||
GlanceUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -209,19 +209,16 @@ class HorizonRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the horizon component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "N/A"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [HorizonRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the horizon component."
|
||||||
HorizonInstaller.__name__,
|
out = description.format(**params)
|
||||||
HorizonUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -190,19 +190,16 @@ def get_shared_params(cfg):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the keystone component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [KeystoneRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the keystone component."
|
||||||
KeystoneInstaller.__name__,
|
out = description.format(**params)
|
||||||
KeystoneUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -50,19 +50,16 @@ class KeyStoneClientRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the keystone client component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [KeyStoneClientRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the keystone client component."
|
||||||
KeyStoneClientInstaller.__name__,
|
out = description.format(**params)
|
||||||
KeyStoneClientUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -444,19 +444,16 @@ class NovaConf(object):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the nova component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [NovaRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the nova component."
|
||||||
NovaInstaller.__name__,
|
out = description.format(**params)
|
||||||
NovaUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -57,19 +57,16 @@ class NovaClientRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the nova client component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [NovaClientRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the nova client component."
|
||||||
NovaClientUninstaller.__name__,
|
out = description.format(**params)
|
||||||
NovaClientInstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -80,19 +80,16 @@ class NoVNCRuntime(comp.ProgramRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the nova no-vnc component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [NoVNCRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the no-vnc component."
|
||||||
NoVNCUninstaller.__name__,
|
out = description.format(**params)
|
||||||
NoVNCInstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -49,19 +49,16 @@ class OpenstackXRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the openstack x component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [OpenstackXRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the no-vnc component."
|
||||||
OpenstackXInstaller.__name__,
|
out = description.format(**params)
|
||||||
OpenstackXUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -201,19 +201,16 @@ class QuantumRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the quantum component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [QuantumRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the quantum component."
|
||||||
QuantumInstaller.__name__,
|
out = description.format(**params)
|
||||||
QuantumUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -112,19 +112,16 @@ class RabbitRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the rabbit-mq component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [RabbitRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the rabbit-mq component."
|
||||||
RabbitUninstaller.__name__,
|
out = description.format(**params)
|
||||||
RabbitInstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -63,19 +63,16 @@ class SwiftRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
|
|
||||||
def describe(opts=None):
|
def describe(opts=None):
|
||||||
description = """ Module: {module_name}
|
description = """
|
||||||
|
Module: {module_name}
|
||||||
Description:
|
Description:
|
||||||
Handles actions for the swift component.
|
{description}
|
||||||
Component options:
|
Component options:
|
||||||
{component_opts}
|
{component_opts}
|
||||||
Provides:
|
|
||||||
{provides_what}
|
|
||||||
"""
|
"""
|
||||||
params = dict()
|
params = dict()
|
||||||
params['component_opts'] = "TBD"
|
params['component_opts'] = "TBD"
|
||||||
params['module_name'] = __name__
|
params['module_name'] = __name__
|
||||||
provides = [SwiftRuntime.__name__,
|
params['description'] = __doc__ or "Handles actions for the swift component."
|
||||||
SwiftInstaller.__name__,
|
out = description.format(**params)
|
||||||
SwiftUninstaller.__name__]
|
return out.strip("\n")
|
||||||
params['provides_what'] = ", ".join(sorted(provides))
|
|
||||||
return description.format(**params)
|
|
||||||
|
|||||||
@@ -15,6 +15,10 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
#requires http://pypi.python.org/pypi/termcolor
|
||||||
|
#but the colors make it worth it :-)
|
||||||
|
from termcolor import colored, cprint
|
||||||
|
|
||||||
from devstack import log as logging
|
from devstack import log as logging
|
||||||
from devstack import settings
|
from devstack import settings
|
||||||
from devstack import utils
|
from devstack import utils
|
||||||
@@ -57,18 +61,10 @@ def log_deps(components):
|
|||||||
while left_show:
|
while left_show:
|
||||||
c = left_show.pop()
|
c = left_show.pop()
|
||||||
deps = settings.get_dependencies(c)
|
deps = settings.get_dependencies(c)
|
||||||
dep_str = ""
|
dep_str = "depends on:"
|
||||||
dep_len = len(deps)
|
print(colored(c, "green", attrs=['bold']) + " depends on " + dep_str)
|
||||||
if dep_len >= 1:
|
|
||||||
dep_str = "component"
|
|
||||||
if dep_len > 1:
|
|
||||||
dep_str += "s"
|
|
||||||
dep_str += ":"
|
|
||||||
elif dep_len == 0:
|
|
||||||
dep_str = "no components."
|
|
||||||
LOG.info("%s depends on %s" % (c, dep_str))
|
|
||||||
for d in deps:
|
for d in deps:
|
||||||
LOG.info("\t%s" % (d))
|
print(" " + colored(d, "blue", attrs=['bold']))
|
||||||
shown.add(c)
|
shown.add(c)
|
||||||
for d in deps:
|
for d in deps:
|
||||||
if d not in shown and d not in left_show:
|
if d not in shown and d not in left_show:
|
||||||
@@ -86,33 +82,17 @@ def _run_describe_comps(args):
|
|||||||
components = settings.parse_components(args.get("components"), True)
|
components = settings.parse_components(args.get("components"), True)
|
||||||
c_keys = sorted(components.keys())
|
c_keys = sorted(components.keys())
|
||||||
for c in c_keys:
|
for c in c_keys:
|
||||||
LOG.info("Component %s {", c)
|
print(colored(c, "green", attrs=['bold']) + " description:")
|
||||||
describer = _DESCR_MAP.get(c)
|
describer = _DESCR_MAP.get(c)
|
||||||
info = describer(components.get(c))
|
print(describer(components.get(c)))
|
||||||
if info:
|
|
||||||
lines = info.splitlines()
|
|
||||||
for line in lines:
|
|
||||||
if len(line) == 0:
|
|
||||||
continue
|
|
||||||
#do some basic formatting
|
|
||||||
mtch = re.match(r"^(\s*)(.*)$", line)
|
|
||||||
new_line = line
|
|
||||||
if mtch:
|
|
||||||
space_am = len(mtch.group(1)) * 2
|
|
||||||
new_line = " " * space_am + mtch.group(2)
|
|
||||||
LOG.info(new_line)
|
|
||||||
LOG.info("}")
|
|
||||||
|
|
||||||
|
|
||||||
def run(args):
|
def run(args):
|
||||||
prog_name = PROG_NAME
|
sep = utils.welcome(PROG_NAME)
|
||||||
if args.get('list_deps'):
|
|
||||||
prog_name += " [DEPS]"
|
|
||||||
if args.get('describe_comp'):
|
|
||||||
prog_name += " [DESCRIBE]"
|
|
||||||
utils.welcome(prog_name)
|
|
||||||
if args.get('list_deps'):
|
if args.get('list_deps'):
|
||||||
_run_list_deps(args)
|
_run_list_deps(args)
|
||||||
|
print(sep)
|
||||||
if args.get('describe_comp'):
|
if args.get('describe_comp'):
|
||||||
_run_describe_comps(args)
|
_run_describe_comps(args)
|
||||||
|
print(sep)
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ def welcome(ident):
|
|||||||
lower += "|"
|
lower += "|"
|
||||||
welcome_header = _get_welcome_stack().strip("\n\r")
|
welcome_header = _get_welcome_stack().strip("\n\r")
|
||||||
max_line_len = len(max(welcome_header.splitlines(), key=len))
|
max_line_len = len(max(welcome_header.splitlines(), key=len))
|
||||||
footer = colored(settings.PROG_NICE_NAME, 'green') + \
|
footer = colored(settings.PROG_NICE_NAME, 'green', attrs=['bold']) + \
|
||||||
": " + colored(lower, 'blue')
|
": " + colored(lower, 'blue', attrs=['bold'])
|
||||||
uncolored_footer = (settings.PROG_NICE_NAME + ": " + lower)
|
uncolored_footer = (settings.PROG_NICE_NAME + ": " + lower)
|
||||||
if max_line_len - len(uncolored_footer) > 0:
|
if max_line_len - len(uncolored_footer) > 0:
|
||||||
#this format string wil center the uncolored text which
|
#this format string wil center the uncolored text which
|
||||||
@@ -301,3 +301,6 @@ def welcome(ident):
|
|||||||
centered_str = center_text(uncolored_footer, " ", max_line_len)
|
centered_str = center_text(uncolored_footer, " ", max_line_len)
|
||||||
footer = centered_str.replace(uncolored_footer, footer)
|
footer = centered_str.replace(uncolored_footer, footer)
|
||||||
print((welcome_header + os.linesep + footer))
|
print((welcome_header + os.linesep + footer))
|
||||||
|
tail_end = "-" * max_line_len
|
||||||
|
print(tail_end)
|
||||||
|
return tail_end
|
||||||
|
|||||||
Reference in New Issue
Block a user