2

What I am working with:

  • Debian Wheezy 7.6
  • Chef: 11.14.6

Up to this point, I have always used node.name to set the hostname of an instance. Example:

{
  "name": "web-01",
  "chef_environment": "_default",
  "normal": {
    "tags": [

    ]
  },
  "run_list": [
    "recipe[[email protected]]"
  ]

}

However recently, setting the node.name from the "name" key stopped working. node.name remains as the hostname provided by my cloud provider. This occurs when running chef-client, chef-solo, and even in the chef-shell. It seems to set correctly in my client.rb, but still no node.name does not update. I tried running with the -N flag, but still no success.

Anyone else running into this issue? How do I set node.name? Or rather how is node.name set?

1
  • Have you tried removing the node from the chef server and rerunning chef-client again? Feb 5, 2015 at 3:01

1 Answer 1

0

As I discovered, the attribute is set differently in chef-client compared to chef-solo. Chef solo likes node[:name] and chef-client uses node.name. If anyone has insight on why, it would be appreciated.

if Chef::Config[:solo]
  node[:name]
else
  node.name
end

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .