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


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: chef-solo and override attributes will not work in json role
  • Date: Fri, 17 Jan 2014 09:00:41 -0800

On Friday, January 17, 2014 at 12:30 AM, David Montgomery wrote:
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


What does the logging output say your run_list and expanded run_list are? Are you 100% sure that the role is getting applied?

I’ve tested your role’s syntax with:

  ruby -rubygems -rchef -rchef/role -e 'p Chef::JSONCompat.from_json(IO.read("ex-role.json"))’

And I get:

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

So your syntax is fine and the override attributes seem to be getting picked up.

-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§