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

Properly handle empty values #52

Merged
merged 1 commit into from Jul 15, 2013
Merged

Properly handle empty values #52

merged 1 commit into from Jul 15, 2013

Conversation

otherwiseguy
Copy link
Contributor

It is a legitimate use case to set empty values; to override a
default when an empty value is acceptable for instance. This patch
changes the regex in three ways: it 1) removes the requirement for
a non-whitespace terminator on a setting value, 2) makes the value
match non-greedy so that the \s_$ at the end can catch the newline
and 3) changes the \s_=\s* to [ \t]=[ \t] because we don't want
that to capture any whitespace (like a newline).

It is a legitimate use case to set empty values; to override a
default when an empty value is acceptable for instance. This patch
changes the regex in three ways: it 1) removes the requirement for
a non-whitespace terminator on a setting value, 2) makes the value
match non-greedy so that the \s*$ at the end can catch the newline
and 3) changes the \s*=\s* to [ \t]*=[ \t]* because we don't want
that to capture *any* whitespace (like a newline).
@cprice404
Copy link

This is the second pull request that has come in for this type of feature, so there's obviously demand for it. We'll get it in ASAP.

@otherwiseguy
Copy link
Contributor Author

Yeah, I looked at mgagne's as well and tried to address the issue that he found in his patch and to add more tests, since that seemed to be one of the hold ups.

@apenney
Copy link

apenney commented Jul 15, 2013

We're working on stealing this module from cprice and taking it over within puppetlabs. As a result I copied this PR over to #1 and then merged it.

@apenney
Copy link

apenney commented Jul 15, 2013

(I take it back, we're going to work on transferring this over so we don't lose attribution for all your PRs)

apenney pushed a commit that referenced this pull request Jul 15, 2013
Properly handle empty values
@apenney apenney merged commit 4b91153 into puppetlabs:master Jul 15, 2013
@smortex smortex added the bugfix label Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants