[chef] Re: Re: Re: Re: chef-solo and override attributes will not work in json role


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: chef-solo and override attributes will not work in json role
  • Date: Fri, 17 Jan 2014 16:30:44 +0800

Him,

Still kinda stunned that chef will not work..now rather concerned and have to hardcode to get around this till resolved.  What am I missing from the docs? How else can I create a role based execution patten in light override_attributes are not working?

Opscode..any comment?

[["set_unless_enabled?", false],
 ["default", {"git_repos"=>[]}],
 ["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]]
Converging 4 resources
Recipe: environment::scm
  * package[git-core] action install (up to date)
  * file[/root/.ssh/id_rsa] action create (up to date)
  * cookbook_file[/root/.ssh/id_rsa] action create (up to date)
  * directory[/home/ubuntu/workspace/] action create (up to date)


here is my role:

{
    "name": "orderbook_server",
    "chef_type": "role",
    "description": "orderbook server",
    "override_attributes": {"environment":{"git_repos":["logic"]}},
    "run_list": [
                 "recipe[environment::scm]"
                
                ]
}

In the recipe..the code I am trying to execute

git_repos = node["environment"]["git_repos"]
git_repos.each do |repo|
  //do stuff
end



















On Fri, Jan 17, 2014 at 6:18 AM, Daniel DeLeo < " target="_blank"> > wrote:

On Thursday, January 16, 2014 at 1:30 PM, David Montgomery wrote:

Then what do I do?  default_attributes?  will that work?

Kinda confused...why is the below in the docs?

http://docs.opscode.com/chef_solo.html


{
  "name": "test",
  "default_attributes": { },
  "override_attributes": { },
  "json_class": "Chef::Role",
  "description": "This is just a test role, no big deal.",
  "chef_type": "role",
  "run_list": [ "recipe[test]" ]
}


Sorry, I misread your original post, I thought you were trying to pass something like that in using -j JSON_FILE, which doesn’t work.

As far as I can tell from what you’ve posted, your example should work as long as your role is getting picked up in the run_list. You could try adding code like this to debug your attributes:

  require 'pp'
  pp node.debug_value(“environment")

You can also try running chef with debug logging to see if anything else looks odd.

-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§