Also you don't want to use node.set, you want to use node.default or maybe node.override if you have to. When you use node.set that is an alias for node.normal which has the side effect of persisting data permanently in the node object. If you delete those lines, you'll find the attributes are still set, which can be highly confusing. The normal and override attribute precedence levels are actually wiped at the start of the chef run and re-built completely by your code which is what you actually want. You should only use 'node.set' or 'node.normal' if you're doing something like generating a password for a database on the first run and you need to remember that (and even there you should probably use a data bag).
And one last thing is that its better to move those kinds of settings into an attributes file if at all possible and not set attributes in recipe code like that.
On 2/12/15 3:53 PM, Sean Clemmer wrote:
Yes.
The first version will replace the entire node.openssh.server attribute with the Hash you've provided. The second will only update node.openssh.server.port and node.openssh.server.permit_root_login. So if there were other attributes like node.openssh.server.example declared elsewhere, the first version would blow away this value, while the second would not.
On Thu, Feb 12, 2015 at 3:41 PM, Greg Barker < " target="_blank"> > wrote:
This is for my "base cookbook", wasn't sure if there was a difference between setting attributes like this:
node.set["openssh"]["server"] = { "port" => 22, "permit_root_login" => "no" }Versus setting them like this:
node.set["openssh"]["server"]["port"] = 22 node.set["openssh"]["server"]["permit_root_login"] = "no"Thanks!
Archive powered by MHonArc 2.6.16.