add a -v command line switch to increase output verbosity
This commit is contained in:
parent
78a59e7850
commit
e5791eaa34
@ -43,6 +43,12 @@ def parse():
|
|||||||
action="append",
|
action="append",
|
||||||
dest="component",
|
dest="component",
|
||||||
help="openstack component: %s" % (_format_list(settings.COMPONENT_NAMES)))
|
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 = OptionGroup(parser, "Install & uninstall & start & stop specific options")
|
||||||
base_group.add_option("-a", "--action",
|
base_group.add_option("-a", "--action",
|
||||||
@ -104,7 +110,6 @@ def parse():
|
|||||||
output['ignore_deps'] = not options.ensure_deps
|
output['ignore_deps'] = not options.ensure_deps
|
||||||
output['keep_old'] = options.keep_old
|
output['keep_old'] = options.keep_old
|
||||||
output['extras'] = args
|
output['extras'] = args
|
||||||
|
output['verbosity'] = len(options.verbosity)
|
||||||
LOG.debug("Extracted options %s" % (output))
|
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
6
stack
6
stack
@ -16,6 +16,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -114,6 +115,11 @@ def main():
|
|||||||
args = opts.parse()
|
args = opts.parse()
|
||||||
prog_name = sys.argv[0]
|
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
|
#will need root to setup openstack
|
||||||
if not sh.got_root():
|
if not sh.got_root():
|
||||||
rest_args = sys.argv[1:]
|
rest_args = sys.argv[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user