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

Removing newline character at end of export_line #95

Merged
merged 1 commit into from
May 8, 2017

Conversation

gziskind
Copy link
Contributor

@gziskind gziskind commented Mar 24, 2017

This is needed because in the "line" cookbook resource "replace_or_add", the value for line is compared to the existing line in the /etc/exports file, but modified with .chomp

# line/libraries/provider_replace_or_add.rb
# Lines: 51-55

unless line.chomp == new_resource.line
  line = new_resource.line
  modified = true
end

So, when "new_resource.line" ends with a '\n' character, it will never be equal to line.chomp, so it will always be marked as modified = true. When modified is set to true, the resource is declared as updated by the last action, so the line notifies :run, 'execute[exportfs]', :immediately will notify execute[exportfs] everytime, even if there was no update to the line.

@atomic-penguin atomic-penguin merged commit 7a1085f into sous-chefs:master May 8, 2017
atomic-penguin added a commit that referenced this pull request May 8, 2017
* gziskind
 - remove trailing newline from export line. Closes #95
@atomic-penguin
Copy link
Contributor

@gziskind can you provide a sample test case to reproduce this bug?

atomic-penguin added a commit that referenced this pull request Aug 8, 2017
* Correct #95 regression on v2.4.0
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.

2 participants