Added trace of post_install commands

This commit is contained in:
Ken 2012-01-24 13:48:13 -08:00
parent c06455b948
commit 694f211fa8
3 changed files with 26 additions and 15 deletions
devstack

@ -121,7 +121,7 @@ class NovaInstaller(comp.PythonInstallComponent):
mp['FLOATING_RANGE'] = self.cfg.get('nova', 'floating_range')
mp['TEST_FLOATING_RANGE'] = self.cfg.get('nova', 'test_floating_range')
mp['TEST_FLOATING_POOL'] = self.cfg.get('nova', 'test_floating_pool')
utils.execute_template(*POST_INSTALL_CMDS, params=mp)
utils.execute_template(*POST_INSTALL_CMDS, params=mp, tracewriter=self.tracewriter)
return parent_result
def _setup_db(self):
@ -183,7 +183,7 @@ class NovaRuntime(comp.PythonRuntime):
# This class has the smarts to build the configuration file based on
# various runtime values
class NovaConfigurator():
class NovaConfigurator(object):
def __init__(self, cfg, instances):
self.cfg = cfg
self.instances = instances
@ -351,7 +351,7 @@ class NovaConfigurator():
# This class represents the data in the nova config file
class NovaConf():
class NovaConf(object):
def __init__(self):
self.lines = list()

@ -32,6 +32,7 @@ FILE_TOUCHED = "FILE_TOUCHED"
DOWNLOADED = "DOWNLOADED"
AP_STARTED = "AP_STARTED"
PIP_INSTALL = 'PIP_INSTALL'
EXEC_CMD = 'EXEC_CMD'
#trace file types
PY_TRACE = "python"
@ -139,6 +140,13 @@ class TraceWriter(object):
data['trace_fn'] = info_fn
self.tracer.trace(AP_STARTED, json.dumps(data))
def exec_cmd(self, cmd, result):
self._start()
data = dict()
data['cmd'] = cmd
data['result'] = result
self.tracer.trace(EXEC_CMD, json.dumps(data))
class TraceReader(object):
def __init__(self, root, name):

@ -37,6 +37,7 @@ LOG = logging.getLogger("devstack.util")
def execute_template(*cmds, **kargs):
params_replacements = kargs.pop('params', None)
tracewriter = kargs.pop('tracewriter', None)
ignore_missing = kargs.pop('ignore_missing', False)
cmd_results = list()
for cmdinfo in cmds:
@ -61,6 +62,8 @@ def execute_template(*cmds, **kargs):
stdin = joinlinesep(*stdin_full)
root_run = cmdinfo.get('run_as_root', False)
exec_res = sh.execute(*cmd_to_run, run_as_root=root_run, process_input=stdin, **kargs)
if tracewriter:
tracewriter.exec_cmd(cmd_to_run, exec_res)
cmd_results.append(exec_res)
return cmd_results
@ -220,36 +223,36 @@ def _get_welcome_stack():
possibles.append(r'''
___ ___ ___ _ _ ___ _____ _ ___ _ __
/ _ \| _ \ __| \| / __|_ _/_\ / __| |/ /
| (_) | _/ _|| .` \__ \ | |/ _ \ (__| ' <
| (_) | _/ _|| .` \__ \ | |/ _ \ (__| ' <
\___/|_| |___|_|\_|___/ |_/_/ \_\___|_|\_\
''')
''')
possibles.append(r'''
____ ___ ____ _ _ ____ ___ ____ ____ _ _
| | |__] |___ |\ | [__ | |__| | |_/
|__| | |___ | \| ___] | | | |___ | \_
____ ___ ____ _ _ ____ ___ ____ ____ _ _
| | |__] |___ |\ | [__ | |__| | |_/
|__| | |___ | \| ___] | | | |___ | \_
''')
possibles.append(r'''
_ ___ ___ _ _ __ ___ _ __ _ _
/ \| o \ __|| \| |/ _||_ _|/ \ / _|| |//
( o ) _/ _| | \\ |\_ \ | || o ( (_ | (
( o ) _/ _| | \\ |\_ \ | || o ( (_ | (
\_/|_| |___||_|\_||__/ |_||_n_|\__||_|\\
''')
possibles.append(r'''
_ ___ ___ _ __ ___ _____ _ __ _
_ ___ ___ _ __ ___ _____ _ __ _
,' \ / o |/ _/ / |/ /,' _//_ _/.' \ ,'_/ / //7
/ o |/ _,'/ _/ / || /_\ `. / / / o // /_ / ,'
|_,'/_/ /___//_/|_//___,' /_/ /_n_/ |__//_/\\
/ o |/ _,'/ _/ / || /_\ `. / / / o // /_ / ,'
|_,'/_/ /___//_/|_//___,' /_/ /_n_/ |__//_/\\
''')
possibles.append(r'''
_____ ___ ___ _ _ ___ _____ _____ ___ _ _
_____ ___ ___ _ _ ___ _____ _____ ___ _ _
( _ )( _`\ ( _`\ ( ) ( )( _`\(_ _)( _ )( _`\ ( ) ( )
| ( ) || |_) )| (_(_)| `\| || (_(_) | | | (_) || ( (_)| |/'/'
| | | || ,__/'| _)_ | , ` |`\__ \ | | | _ || | _ | , <
| (_) || | | (_( )| |`\ |( )_) | | | | | | || (_( )| |\`\
| | | || ,__/'| _)_ | , ` |`\__ \ | | | _ || | _ | , <
| (_) || | | (_( )| |`\ |( )_) | | | | | | || (_( )| |\`\
(_____)(_) (____/'(_) (_)`\____) (_) (_) (_)(____/'(_) (_)
''')