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

Update to default.rb library to handle frozen strings #430

Merged
merged 2 commits into from
Apr 12, 2017

Conversation

bphinney
Copy link
Contributor

When running under Chef client 13, Chef issues an error on the prepend method for the string because the strings are frozen objects. By moving the whitespace characters to the original array creation, we can do a simple non-destructive join, which solves the issue of not being allowed to change a frozen string in chef.

In Chef 13, the prepend method on the string is failing due to Chef freezing objects.  By moving the extra whitespace characters to the original array, we are able to bypass that frozen object failure which just leaves us with joining the items.
@bphinney bphinney closed this Apr 12, 2017
@bphinney bphinney reopened this Apr 12, 2017
@bphinney
Copy link
Contributor Author

If you are actually adding kernel options, without this change, Chef 13 will throw an error.

@jjasghar
Copy link
Contributor

Awesome! thanks for this!

@jjasghar jjasghar merged commit 0a7f41b into rabbitmq:master Apr 12, 2017
end

rendered.each { |r| r.prepend(' ') }.join(",\n")
rendered.each { |r| r }.join(",\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to keep .each {} for this line or can it go away?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like it can go.

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.

4 participants