[chef] Re: Is there a difference between setting attributes like this?


Chronological Thread 
  • From: Sean Clemmer < >
  • To: Opscode Chef < >
  • Subject: [chef] Re: Is there a difference between setting attributes like this?
  • Date: Thu, 12 Feb 2015 15:53:31 -0800

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.

§