From e5791eaa34fc721ad9339b5b18875c1dc80fa53d Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 7 Mar 2012 17:44:25 -0500 Subject: [PATCH] add a -v command line switch to increase output verbosity --- devstack/opts.py | 9 +++++++-- stack | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/devstack/opts.py b/devstack/opts.py index 2cfea679..0e6452c0 100644 --- a/devstack/opts.py +++ b/devstack/opts.py @@ -43,6 +43,12 @@ def parse(): action="append", dest="component", help="openstack component: %s" % (_format_list(settings.COMPONENT_NAMES))) + parser.add_option("-v", "--verbose", + action="append_const", + const=1, + dest="verbosity", + default=[1], + help="increase the verbose level") base_group = OptionGroup(parser, "Install & uninstall & start & stop specific options") base_group.add_option("-a", "--action", @@ -104,7 +110,6 @@ def parse(): output['ignore_deps'] = not options.ensure_deps output['keep_old'] = options.keep_old output['extras'] = args - - LOG.debug("Extracted options %s" % (output)) + output['verbosity'] = len(options.verbosity) return output diff --git a/stack b/stack index 8c0d5cb8..76e7a194 100755 --- a/stack +++ b/stack @@ -16,6 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. +import logging import logging.config import os import sys @@ -114,6 +115,11 @@ def main(): args = opts.parse() prog_name = sys.argv[0] + # Adjust logging verbose level based on the command line switch. + if args['verbosity'] >= 2: + lg.getLogger().setLevel(logging.DEBUG) + LOG.debug("Command line options %s" % (args)) + #will need root to setup openstack if not sh.got_root(): rest_args = sys.argv[1:]