Update swift-config paste appconfig inspection
This crafts a significantly more informative and complete picture of the appconfig object after paste has gotten a hold of it. Change-Id: I07d7248ecf384f32d333025874ecb2782c58d6af
This commit is contained in:
parent
4dfe31e69e
commit
28bee715dc
@ -29,6 +29,28 @@ parser.add_option('-w', '--wsgi', action='store_true',
|
|||||||
help="use wsgi/paste parser instead of readconf")
|
help="use wsgi/paste parser instead of readconf")
|
||||||
|
|
||||||
|
|
||||||
|
def _context_name(context):
|
||||||
|
return ':'.join((context.object_type.name, context.name))
|
||||||
|
|
||||||
|
|
||||||
|
def inspect_app_config(app_config):
|
||||||
|
conf = {}
|
||||||
|
context = app_config.context
|
||||||
|
section_name = _context_name(context)
|
||||||
|
conf[section_name] = context.config()
|
||||||
|
if context.object_type.name == 'pipeline':
|
||||||
|
filters = context.filter_contexts
|
||||||
|
pipeline = []
|
||||||
|
for filter_context in filters:
|
||||||
|
conf[_context_name(filter_context)] = filter_context.config()
|
||||||
|
pipeline.append(filter_context.entry_point_name)
|
||||||
|
app_context = context.app_context
|
||||||
|
conf[_context_name(app_context)] = app_context.config()
|
||||||
|
pipeline.append(app_context.entry_point_name)
|
||||||
|
conf[section_name]['pipeline'] = ' '.join(pipeline)
|
||||||
|
return conf
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
options = dict(vars(options))
|
options = dict(vars(options))
|
||||||
@ -45,10 +67,7 @@ def main():
|
|||||||
print '# %s' % conf_file
|
print '# %s' % conf_file
|
||||||
if options['wsgi']:
|
if options['wsgi']:
|
||||||
app_config = appconfig(conf_file)
|
app_config = appconfig(conf_file)
|
||||||
context = app_config.context
|
conf = inspect_app_config(app_config)
|
||||||
conf = dict([(c.name, c.config()) for c in getattr(
|
|
||||||
context, 'filter_contexts', [])])
|
|
||||||
conf[context.name] = app_config
|
|
||||||
else:
|
else:
|
||||||
conf = readconf(conf_file)
|
conf = readconf(conf_file)
|
||||||
flat_vars = {}
|
flat_vars = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user