Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save patmaddox/9633594 to your computer and use it in GitHub Desktop.

Select an option

Save patmaddox/9633594 to your computer and use it in GitHub Desktop.
<srbaker>SOLVED</srbaker>
default_attributes chef_user: "ubuntu"
default_attributes { ... a whole mess of other stuff which apparently blows away the first line. whoops }
when recipes_rbenv.rb is loaded, node['chef_user'] is nil. However I can see a
chef_user attribute if I look at the node information on the chef server. I've
also tried passing {'chef_user' => 'ubuntu'} to default_attributes in case it
was a problem with string vs symbol for the key. No luck. Any ideas how I can
get the value of this attribute that's set in the environment's default_attributes?
node.default['rbenv']['user_installs'] = [
{'user' => node['chef_user'] }
]
@patmaddox

Copy link
Copy Markdown
Author

here's what I get when I include puts node.debug_value(:chef_user) in the recipe. Not sure what I'm looking for to tell you the truth…

set_unless_enabled?
false
default
not_present
env_default
not_present
role_default
not_present
force_default
not_present
normal
not_present
override
not_present
role_override
not_present
env_override
not_present
force_override
not_present
automatic
not_present

@patmaddox

Copy link
Copy Markdown
Author

okay got it sorted, you can't call default_attributes twice in an environment file, the second call will blow away the first one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment