Skip to content

Commit

Permalink
Add flag argument to 'cinder-manage config list'
Browse files Browse the repository at this point in the history
Unlike other cinder-manage 'list' commands the 'config list'
option doesn't allow users to specify a filter to limit
the output.  This commit adds the ability to specify
the flag the user wishes to display.

If no flag is specified the default behavior is still to
display all the configured flags.  If the flag requested
is not found, cinder-manage reports that the flag was not
found.

(fixes bug 1187137)

Change-Id: I698f4c06d7e93217d8f307a880e0ae40711151c2
  • Loading branch information
Jay S. Bryant committed Jul 15, 2013
1 parent 54a7345 commit 15bd189
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions bin/cinder-manage
Expand Up @@ -450,9 +450,21 @@ class ConfigCommands(object):
def __init__(self):
pass

def list(self):
for key, value in CONF.iteritems():
if value is not None:
@args('param', nargs='?', default=None,
help='Configuration parameter to display (default: %(default)s)')
def list(self, param=None):
"""List parameters configured for cinder.
Lists all parameters configured for cinder unless an optional argument
is specified. If the parameter is specified we only print the
requested parameter. If the parameter is not found an appropriate
error is produced by .get*().
"""
param = param and param.strip()
if param:
print '%s = %s' % (param, CONF.get(param))
else:
for key, value in CONF.iteritems():
print '%s = %s' % (key, value)


Expand Down
4 changes: 2 additions & 2 deletions doc/source/man/cinder-manage.rst
Expand Up @@ -157,9 +157,9 @@ Cinder Storage Management
Cinder Config
~~~~~~~~~~~~~

``cinder-manage config list``
``cinder-manage config list [<param>]``

Displays the current configuration parameters (options) for Cinder.
Displays the current configuration parameters (options) for Cinder. The optional flag parameter may be used to display the configuration of one parameter.

FILES
=====
Expand Down

0 comments on commit 15bd189

Please sign in to comment.