Fix determining beta value through configuration

This commit is contained in:
Darko Poljak 2018-03-01 19:33:22 +01:00
parent ea702c0c43
commit 23292e5cad
3 changed files with 8 additions and 3 deletions

View file

@ -126,8 +126,7 @@ def get_parsers():
parser['beta'].add_argument(
'-b', '--beta',
help=('Enable beta functionality. '),
action='store_true', dest='beta',
default=False)
action='store_true', dest='beta', default=None)
# Main subcommand parser
parser['main'] = argparse.ArgumentParser(

View file

@ -409,7 +409,12 @@ class Configuration(metaclass=Singleton):
if option in args:
dst_opt = self.ARG_OPTION_MAPPING[option]
option_object = self.CONFIG_FILE_OPTIONS['GLOBAL'][dst_opt]
if args[option] or isinstance(option_object, BooleanOption):
# If option is in args.
# Also if it is boolean but only if not None - this allows
# False to override True.
if (args[option] or
(isinstance(option_object, BooleanOption) and
args[option] is not None)):
d[dst_opt] = args[option]
return d

View file

@ -10,6 +10,7 @@ next:
* Core: Fix non-existent manifest non graceful handling (Darko Poljak)
* Core: Fix main and inventory parent argparse options (Darko Poljak)
* Core: Fix lost error info with parallel jobs (option -j) (Darko Poljak)
* Core: Fix determining beta value through configuration (Darko Poljak)
4.8.0: 2018-02-14
* Core: Skip empty lines in parameter files (Darko Poljak)