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


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

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]" ]
}



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

On Thursday, January 16, 2014 at 12:28 AM, David Montgomery wrote:

Do override attributes work in chef-solo?

Here is my role:


{
    "name": "server",
    "chef_type": "role",
    "description": "server",
    "override_attributes": {"environment":{"git_repos":["logic"]}},
    "run_list": ["recipe[build-essential]","recipe[java]","recipe[environment::scm]" ]
}


In my cookbook called "environment"...in attributes have this this:

#cookbooks/'environment/attributes/default.rb
default['environment']['git_repos'] = []


In my scm recipe "recipe[environment::scm]" I have this for a test:

git_repos = node['environment']['git_repos']
git_repos.each do |repo|

  directory "/home/ubuntu/wtf/" do
    owner "root"
    group "root"
    #mode "0775"
    recursive true
    action :create
  end

end


Nothing.....no errors ....no nothing.  So..do overide attributes work?  Is so..then why not working for me?

Thanks



Override attributes are only set by cookbooks, roles, or environments. Attributes from the json file are always “normal” level, which is similar to how they work in chef-client.

-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§