Last active
August 29, 2015 13:57
-
-
Save patmaddox/9633594 to your computer and use it in GitHub Desktop.
<srbaker>SOLVED</srbaker>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| default_attributes chef_user: "ubuntu" | |
| default_attributes { ... a whole mess of other stuff which apparently blows away the first line. whoops } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node.default['rbenv']['user_installs'] = [ | |
| {'user' => node['chef_user'] } | |
| ] |
Author
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
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
thanks for the reply @fujin
well I reference chef_user a bunch of places, including in my own templates. I'm pretty confused because I thought this worked just fine when I did a knife bootstrap and along with a couple other chef-client updates, but now it's not working. I'm under the impression that chef can't / shouldn't just stop working like that so I'm not really sure what's going on.
But anyway yeah there are like 15 references to chef_user in other recipes, so I do need to sort out how to get the recipe to read the attribute as set in the environment.