-
Notifications
You must be signed in to change notification settings - Fork 16
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
Bring cookbook up to Chef 13 compliance #20
Conversation
Also to note, I tested & verified my changes on Chef version |
Thanks for investigating this! The PR looks good to me, I'd just ask you to remove the |
@chr4 I've reverted the I also added my |
The Vagrantfile in .gitignore is fine for me. This completely disables node configuration. Maybe we can use something like this to continue supporting it? attribute :head, kind_of: [Array, String], default: node['resolvconf']['head'].dup
attribute :base, kind_of: [Array, String], default: node['resolvconf']['base'].dup
attribute :tail, kind_of: [Array, String], default: node['resolvconf']['tail'].dup This would create a problem though when the default attribute is not set, so maybe there's a way to do something like if node['resolvconf']['base']
node['resolvconf']['base'].dup
else
[]
end What do you think? (I've merged this PR, but didn't release it yet). |
@chr4 Why was this PR reverted? |
It was not reverted, I just didn't release a new version (including this fix) yet. The reason is, that it breaks existing attribute configurations, see #20 (comment) |
This PR brings this cookbook up to Chef 13 compliance. A breaking change in version 13 did not allow for unsafe access of node attributes in custom resources.
As this cookbook currently stands, this error is thrown when attempting to use the custom resource:
The solution is to call
.dup
on each attribute accessed inside of./resources/default.rb
or to move values directly into that file. I tried to find a good middle-of-the-road solution.For anything that had a simple (read: 1 liner or blank array) value, I moved it directly into the
./resources/default.rb
file and removed it from./attributes/default.rb
. I also migrated the comments where appropriate.For larger values, I left them in
./attributes/default.rb
and called the.dup
method on them to safely clone the node attribute when it is referenced inside of the custom resource file.I know this is kind of an ugly PR, and I am happy to work with the maintainer to clean it up. I am not sure if you would prefer for everything to be placed directly into
./resources/default.rb
or leave it as is and instead call.dup
on every node attribute referenced.