From b657ba82219da405e310c5e8222f403ab01ed55e Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Fri, 20 Sep 2019 19:50:55 +0200 Subject: [PATCH] Fix log level when verbosity option is not specified --- cdist/argparse.py | 1 + cdist/preos/debootstrap/debootstrap.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cdist/argparse.py b/cdist/argparse.py index 3ccc0545..34493379 100644 --- a/cdist/argparse.py +++ b/cdist/argparse.py @@ -21,6 +21,7 @@ parser = None _verbosity_level_off = -2 _verbosity_level = { + None: logging.WARNING, _verbosity_level_off: logging.OFF, -1: logging.ERROR, 0: logging.WARNING, diff --git a/cdist/preos/debootstrap/debootstrap.py b/cdist/preos/debootstrap/debootstrap.py index 617d280b..bd8e5759 100644 --- a/cdist/preos/debootstrap/debootstrap.py +++ b/cdist/preos/debootstrap/debootstrap.py @@ -173,11 +173,11 @@ class Debian(object): env = vars(args) new_env = {} for key in env: - if key == 'verbose': - if env[key] >= 3: - new_env['debug'] = "yes" - elif env[key] == 2: - new_env['verbose'] = "yes" + if key == 'verbose' and env[key]: + if env[key] >= 3: + new_env['debug'] = "yes" + elif env[key] == 2: + new_env['verbose'] = "yes" elif not env[key]: new_env[key] = '' elif isinstance(env[key], bool) and env[key]: