Finally remove deprecated -d/--debug option.

This commit is contained in:
Darko Poljak 2017-06-30 09:08:22 +02:00 committed by Steven Armstrong
parent 015861e63b
commit cef1d215b2
3 changed files with 9 additions and 28 deletions

View file

@ -18,7 +18,6 @@ parser = None
_verbosity_level_off = -2
_verbosity_level_debug = 3
_verbosity_level = {
_verbosity_level_off: logging.OFF,
-1: logging.ERROR,
@ -86,10 +85,6 @@ def get_parsers():
parser = {}
# Options _all_ parsers have in common
parser['loglevel'] = argparse.ArgumentParser(add_help=False)
parser['loglevel'].add_argument(
'-d', '--debug',
help=('Set log level to debug (deprecated, use -vvv instead)'),
action='store_true', default=False)
parser['loglevel'].add_argument(
'-q', '--quiet',
help='Quiet mode: disables logging, including WARNING and ERROR',
@ -223,15 +218,7 @@ def get_parsers():
def handle_loglevel(args):
if args.debug:
retval = "-d/--debug is deprecated, use -vvv instead"
args.verbose = _verbosity_level_debug
else:
retval = None
if args.quiet:
args.verbose = _verbosity_level_off
logging.root.setLevel(_verbosity_level[args.verbose])
return retval

View file

@ -11,23 +11,23 @@ SYNOPSIS
::
cdist [-h] [-d] [-v] [-V] {banner,config,shell,install} ...
cdist [-h] [-v] [-V] {banner,config,shell,install} ...
cdist banner [-h] [-d] [-v]
cdist banner [-h] [-v]
cdist config [-h] [-d] [-v] [-b] [-C CACHE_PATH_PATTERN] [-c CONF_DIR]
cdist config [-h] [-v] [-b] [-C CACHE_PATH_PATTERN] [-c CONF_DIR]
[-i MANIFEST] [-j [JOBS]] [-n] [-o OUT_PATH]
[--remote-copy REMOTE_COPY] [--remote-exec REMOTE_EXEC]
[-f HOSTFILE] [-p] [-r REMOTE_OUT_PATH] [-s]
[host [host ...]]
cdist install [-h] [-d] [-v] [-b] [-C CACHE_PATH_PATTERN] [-c CONF_DIR]
cdist install [-h] [-v] [-b] [-C CACHE_PATH_PATTERN] [-c CONF_DIR]
[-i MANIFEST] [-j [JOBS]] [-n] [-o OUT_PATH]
[--remote-copy REMOTE_COPY] [--remote-exec REMOTE_EXEC]
[-f HOSTFILE] [-p] [-r REMOTE_OUT_PATH] [-s]
[host [host ...]]
cdist shell [-h] [-d] [-v] [-s SHELL]
cdist shell [-h] [-v] [-s SHELL]
DESCRIPTION
@ -46,10 +46,6 @@ All commands accept the following options:
Show the help screen
.. option:: -d, --debug
Set log level to debug (deprecated, use -vvv instead)
.. option:: -q, --quiet
Quiet mode: disables logging, including WARNING and ERROR
@ -211,7 +207,7 @@ EXAMPLES
.. code-block:: sh
# Configure ikq05.ethz.ch with debug enabled
% cdist config -d ikq05.ethz.ch
% cdist config -vvv ikq05.ethz.ch
# Configure hosts in parallel and use a different configuration directory
% cdist config -c ~/p/cdist-nutzung \
@ -245,7 +241,7 @@ EXAMPLES
[--group GROUP] [--owner OWNER] [--mode MODE] object_id
# Install ikq05.ethz.ch with debug enabled
% cdist install -d ikq05.ethz.ch
% cdist install -vvv ikq05.ethz.ch
ENVIRONMENT
-----------

View file

@ -40,12 +40,10 @@ def commandline():
args = parser['main'].parse_args(sys.argv[1:])
# Loglevels are handled globally in here
retval = cdist.argparse.handle_loglevel(args)
if retval:
log.warning(retval)
cdist.argparse.handle_loglevel(args)
log.trace(args)
log.info("version %s" % cdist.VERSION)
log.trace(args)
# Work around python 3.3 bug:
# http://bugs.python.org/issue16308