How I can update my attribute of recipe A in a recipe B?


#1

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


#2

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 :nothingend

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 :runend

2014-06-25 16:25 GMT+02:00 Ilisia Felane felane.ili@gmail.com:

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


#3

*Make sure your brain is running before you put your mouth in gear *

Ok sorry, it’s good

Thank,
Felane

2014-06-25 17:11 GMT+02:00 Ilisia Felane felane.ili@gmail.com:

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 :nothingend

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 :runend

2014-06-25 16:25 GMT+02:00 Ilisia Felane felane.ili@gmail.com:

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