Use tab for whitespace when checking sysctl output#60
Open
reidmv wants to merge 1 commit intothias:masterfrom
Open
Use tab for whitespace when checking sysctl output#60reidmv wants to merge 1 commit intothias:masterfrom
reidmv wants to merge 1 commit intothias:masterfrom
Conversation
When outputing a value the sysctl utility will print tabs for
whitespace, rather than space characters. Users, however, will commonly
use spaces rather than tabs when specifying their values.
Prior to this commit, the discrepancy between user input and sysctl
output caused idempotency problems when Puppet was enforcing sysctl
settings such as the following:
sysctl { 'kernel.sem':
ensure => present,
value => '1000 32000 32 512',
}
Puppet would run `sysctl -n kernel.sem` which would output with tabs:
1000 32000 32 512
It would then compare this value to the user input, which had spaces:
1000 32000 32 512
Finding the two values to be different, Puppet would faithfully run
sysctl to "fix" the out-of-sync setting.
sysctl -w kernel.sem='1000 32000 32 512'
This commit fixes the problem by having Puppet compare the output of
sysctl with a tab-whitespace version of the user input, even if the user
specified spaces.
This logic (whitespace normalization) has also been used to fix the
problem in several other Puppet sysctl modules.
Author
|
@thias thoughts? |
|
+1 |
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.
When outputing a value the sysctl utility will print tabs for
whitespace, rather than space characters. Users, however, will commonly
use spaces rather than tabs when specifying their values.
Prior to this commit, the discrepancy between user input and sysctl
output caused idempotency problems when Puppet was enforcing sysctl
settings such as the following:
Puppet would run
sysctl -n kernel.semwhich would output with tabs:It would then compare this value to the user input, which had spaces:
Finding the two values to be different, Puppet would faithfully run
sysctl to "fix" the out-of-sync setting.
This commit fixes the problem by having Puppet compare the output of
sysctl with a tab-whitespace version of the user input, even if the user
specified spaces.
This logic (whitespace normalization) has also been used to fix the
problem in several other Puppet sysctl modules.