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

readd ensure_newline param and tests for backwards compatibility #307

Merged
merged 1 commit into from
May 1, 2015

Conversation

bmjen
Copy link
Contributor

@bmjen bmjen commented May 1, 2015

No description provided.

hunner added a commit that referenced this pull request May 1, 2015
readd ensure_newline param and tests for backwards compatibility
@hunner hunner merged commit f24437c into puppetlabs:master May 1, 2015
@@ -134,6 +140,11 @@ def fragment_content(r)
tmp = Puppet::FileServing::Content.indirection.find(@source, :environment => catalog.environment)
fragment_content = tmp.content unless tmp.nil?
end

if self[:ensure_newline]
fragment_content<<"\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be checking to see if it has a newline before appending a newline. If it already ends in \n we will end up making a double newline.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something like

fragment_content << "\n" unless fragment_content =~ /\n$/

@bmjen bmjen deleted the ensure-newline branch May 8, 2015 19:43
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.

4 participants