osmodumpdoc: fix finding cfg when not calling from source tree
When the binary has not been built in the source tree, it was impossible to call osmodumpdoc.py despite the -p <config-path> option. Look for config files in that config-path. Make sure a relative config-path is adjusted when changing to the workdir. Change-Id: I5427d354c289ec4602411c7059c8d80e2b451f7c
This commit is contained in:
parent
f41db1e337
commit
8e4806c5f2
|
@ -28,7 +28,7 @@ def dump_doc(name, port, filename):
|
|||
Returns the number of apps configs could not be dumped for."""
|
||||
|
||||
|
||||
def dump_configs(apps, configs):
|
||||
def dump_configs(apps, configs, confpath):
|
||||
failures = 0
|
||||
successes = 0
|
||||
|
||||
|
@ -41,7 +41,7 @@ def dump_configs(apps, configs):
|
|||
appname = app[3]
|
||||
print "Starting app for %s" % appname
|
||||
proc = None
|
||||
cmd = [app[1], "-c", configs[appname][0]]
|
||||
cmd = [app[1], "-c", os.path.join(confpath, configs[appname][0])]
|
||||
try:
|
||||
proc = subprocess.Popen(cmd, stdin=None, stdout=None)
|
||||
except OSError: # Probably a missing binary
|
||||
|
@ -82,9 +82,10 @@ if __name__ == '__main__':
|
|||
osmoappdesc = osmoutil.importappconf_or_quit(
|
||||
confpath, "osmoappdesc", args.p)
|
||||
|
||||
confpath = os.path.relpath(confpath, workdir)
|
||||
os.chdir(workdir)
|
||||
num_fails, num_sucs = dump_configs(
|
||||
osmoappdesc.apps, osmoappdesc.app_configs)
|
||||
osmoappdesc.apps, osmoappdesc.app_configs, confpath)
|
||||
if num_fails > 0:
|
||||
print >> sys.stderr, "Warning: Skipped %s apps" % num_fails
|
||||
if 0 == num_sucs:
|
||||
|
|
Loading…
Reference in New Issue