[chef] Strange issue with node attributes


Chronological Thread 
  • From: Anand < >
  • To:
  • Subject: [chef] Strange issue with node attributes
  • Date: Mon, 28 Oct 2013 17:37:51 -0700 (PDT)

Hi All,
I'm running into an issue with node attributes and I'm not sure what I'm doing
wrong.

I wrote a wrapper cookbook to the Opscode openssh cookbook
(http://community.opscode.com/cookbooks/openssh). My wrapper is called
"test_openssh" and within it I have two recipes: "test_openssh::base"
 and "test_openssh::compute_node". The idea is that the attribute file for
"base" will set the sshd_config params for nodes that have test_openssh::base
in their run_list and nodes that have test_openssh::compute_node get the
sshd_config params in this recipe applied and not anything else. Below are the
contents of the two recipes and the associated attributes files:

test_openssh::base recipe -
include_recipe "openssh"

test_openssh::base attributes -
default['test_openssh']['version'] = "0.1.0"
node.default["openssh"]["server"]["permit_root_login"] = "without-password"
node.default["openssh"]["server"]["password_authentication"] = "yes"
node.default["openssh"]["server"]["challenge_response_authentication"] = "no"
node.default["openssh"]["server"]["max_startups"] = 2048
node.default["openssh"]["server"]["use_dns"] = "yes"
node.default["openssh"]["server"]["x11_forwarding"] = "yes"
# node.default["openssh"]["server"]["allow_users"] = "*"

test_openssh::compute_node recipe - 
include_recipe "openssh"

test_openssh::compute_node attributes -
default[:test_openssh][:version] = "0.1.0"
node.default["openssh"]["server"]["permit_root_login"] = "without-password"
node.default["openssh"]["server"]["password_authentication"] = "no"
node.default["openssh"]["server"]["challenge_response_authentication"] = "no"
node.default["openssh"]["server"]["max_startups"] = 2048
node.default["openssh"]["server"]["use_dns"] = "no"
node.default["openssh"]["server"]["x11_forwarding"] = "yes"
node.default["openssh"]["server"]["allow_users"] = ["root"]

The real difference between the two recipes is the "allow_users", 
"password_authentication" and "use_dns" parameters. When I apply these changes
on a node I noticed that not all the attributes are applied as expected. For
instance, on a node that is supposed to have only the "base" recipe, the
allow_users parameter gets set even though that line is commented in the
recipe. I've tried a few different node object types - override, force_default
but I can't seem to get to work right. Any assistance with this would be
greatly appreciated.

Thanks in advance,
Anand



Archive powered by MHonArc 2.6.16.

§