Skip to content

Instantly share code, notes, and snippets.

@RobertLowe
Created March 17, 2012 22:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertLowe/2065750 to your computer and use it in GitHub Desktop.
Save RobertLowe/2065750 to your computer and use it in GitHub Desktop.
Load a Chef::Node and convert it to an actual Node object
# load a chef node and turn it into an actual node object
node = Chef::Node.load("xxxx") # returns a hash
node = Chef::Node.new.tap do |n|
n.name( node["name"] )
n.chef_environment( node["chef_environment"] )
n.run_list( node["run_list"])
n.normal_attrs = node["normal"]
n.default_attrs = node["default"]
n.override_attrs = node["override"]
n.automatic_attrs = node["automatic"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment