[chef] Re: How I can update my attribute of recipe A in a recipe B ?


Chronological Thread 
  • From: Ilisia Felane < >
  • To:
  • Subject: [chef] Re: How I can update my attribute of recipe A in a recipe B ?
  • Date: Wed, 25 Jun 2014 17:11:35 +0200

I find my answer.
But I have a prob, one attribute don't change.

My resultat :

Compiled Resource:

 # Declared in /var/chef/cache/cookbooks/A/recipes/default.rb:10:in `from_file'

 execute("download") do
   action [:nothing]
   retries 0
   retry_delay 2
   guard_interpreter :default
   command "wget --user=myid --password=default --no-check-certificate https://**.**.**.**/myurl/myapp"
   backup 5
   returns 0
   cookbook_name "A"
   recipe_name "default"
end

in my command default should have been replaced by mypassword....

default.rb attributes A :
default["A"]["url_source"]        = "url"
default["A"]["id"]                    = "default"
default["A"]["password"]         = "default"


default.rb recipes A :
execute 'download' do
    command "wget --user=#{node['A']['id']} --password=#{node['A']['password']} --no-check-certificate #{node['A']['url_source']}"
    action :nothing
end


default.rb attributes B :
default["B"]["id"]                     = "myid"
default["B"]["password"]         = "mypassword"
default["B"]["url_source_fgl"]   = "https://**.**.**.**/myurl/myapp"
force_override["A"]["url_source"]             = default["B"]["url_source"]
force_override["A"]["id"]                         = default["B"]["id"]
force_override["A"]["password"]              = default["B"]["password"]


default recipe B :
execute 'start' do
    notifies :run, "execute[download]", :immediately
    notifies :restart, "service[apache2]", :immediately
    action :run
end





2014-06-25 16:25 GMT+02:00 Ilisia Felane < " target="_blank"> >:
Hi,

I would like change my default attribute of my recipe A, but not in my recipe A, in a other recipe B. How I can do that ?

I tested that :
node.override['A']['url_source']       = node['B']['url_source']
node.override['A']['id']                   = node['B']['id']
but no work

Thanks

Felane





Archive powered by MHonArc 2.6.16.

§