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

Make :content mandatory #1

Merged
merged 3 commits into from Feb 1, 2015
Merged

Make :content mandatory #1

merged 3 commits into from Feb 1, 2015

Conversation

tampakrap
Copy link
Owner

If the content is empty or whitespace, facter returns the following error:

Fact file /etc/facter/facts.d/$fact.txt was parsed but returned an empty data set

This commit defaults it to whitespace, which is invalid value

validate do |value|
raise ArgumentError, "Content cannot be whitespace" if value.match(/^\s+$/)
fail("Content cannot be empty or whitespace") if value.match(/^\s+$/)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As pointed out by @vikraman, it's still broken for empty strings, eg:

fact { 'environment': content => '' }

If the content is empty or whitespace, facter returns the following error:

Fact file /etc/facter/facts.d/$fact.txt was parsed but returned an empty data set

This commit defaults it to empty string, and invalidates it
also their default/accepted values
@vikraman
Copy link
Collaborator

vikraman commented Feb 1, 2015

👍

vikraman added a commit that referenced this pull request Feb 1, 2015
@vikraman vikraman merged commit 4d3b777 into master Feb 1, 2015
@tampakrap tampakrap deleted the content_not_empty branch February 2, 2015 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants