Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the parser options with values from config file. Fixes #8447. #9040

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 17 additions & 6 deletions salt/utils/parsers.py
Expand Up @@ -238,6 +238,11 @@ def __merge_config_with_cli(self, *args):
# value, this allows to tweak settings on the configuration
# files bypassing the shell option flags
self.config[option.dest] = value
elif option.dest in self.config:
# Let's update the option value with the one from the
# configuration file. This allows the parsers to make use of
# the updated value by using self.options.<option>
setattr(self.options, option.dest, self.config[option.dest])

# Merge parser group options if any
for group in self.option_groups:
Expand All @@ -252,12 +257,18 @@ def __merge_config_with_cli(self, *args):
if value is not None:
# There's an actual value, add it to the config
self.config[option.dest] = value
else:
if value is not None and value != default:
# Only set the value in the config file IF it's not the
# default value, this allows to tweak settings on the
# configuration files bypassing the shell option flags
self.config[option.dest] = value
elif value is not None and value != default:
# Only set the value in the config file IF it's not the
# default value, this allows to tweak settings on the
# configuration files bypassing the shell option flags
self.config[option.dest] = value
elif option.dest in self.config:
# Let's update the option value with the one from the
# configuration file. This allows the parsers to make use
# of the updated value by using self.options.<option>
setattr(self.options,
option.dest,
self.config[option.dest])


class ConfigDirMixIn(object):
Expand Down