Repository navigation
Allow state-output and state-verbose default settings to be set from CLI - #31299
Merged
Merged
Conversation
Contributor
|
Some tests here would be ++. Can I convince you to write a quick one to prevent a regression here? |
Contributor
Author
|
We discussed this offline and made a plan. I believe this should be good to go. |
cachedout
pushed a commit
that referenced
this pull request
Feb 18, 2016
Allow state-output and state-verbose default settings to be set from CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #29795
If
state_outputis set in a config file to be something other than the default, such asstate_output: terse, and you try to override the the setting in the config file from the CLI back to the default setting of--state_output=full, the CLI setting cannot override the setting in the config file. By changing these initial default settings toNonein the config parser, we are able to override the config file with the default settings passed via the CLI. This behavior is also true for thestate_verbosesetting. For example:Original
terseoutput:Attempt to override with default of "full" (reproducing the bug):
With the fix (same behavior from config file):
Proper override with "full" from CLI:
Note: I tested this change with various settings in the master and minion config files against many combinations of overriding the config files via the CLI. The previous behavior works as well as fixing the bug, as the proper defaults here are populated elsewhere in
self.configandself.defaultsvalues in thesalt/utils/parsers.pyfile.This is also how the
--outputoption works. Thedefaultis listed in the parser file asNone, but the default is actuallynested. In this way, the CLI can override a config setting of, for example,output: jsonwith--output=nestedfrom the CLI.