[chef] Отв: Q about accessing variables from other recipe and splitting attribute files by folders


Chronological Thread 
  • From: Daniil S < >
  • To: " " < >
  • Subject: [chef] Отв: Q about accessing variables from other recipe and splitting attribute files by folders
  • Date: Mon, 10 Nov 2014 06:05:17 +0000 (UTC)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=lp0pTZsTLvr4G3lKLCEFkR9y0S4XE6bSDBTK6bCjBhZ8uEtqTjjzYe2aEtb6Imm6gFKtKycj8UQHK8hHH+lzFxNQbj/xnu7BahA1aBKABzaEQSjrzymWY59WcPv/DpKvpHmjbk0V/LhZ/1Rmw9/1C5iACynLJ2Hu1ZDGuysrhou31pjlyp3RYQOdrH52xYs0Cx9bqCAF2XEGSEuWBBMBDW93lG+3SPkKT9BCjsEIvndVVbGoHPVoyAYk7BgsHMvIsNBCJtSzuJYsyDCehFaevcLnr+XXqjUiPyAP5OYtMTuzFkeSvkR+AtZoN9CGmCMZRJn/jTRe2BwHVkUYQleOpg==;

Correction of the 1st question: 'default' recipe contains 'include' of 'somerecipe':
================
cookbooks/cookbook_name/default.rb:
    foo = :bar
    include 'cookbook_name::somerecipe'

cookbooks/cookbook_name/somerecipe.rb:
    Chef::Log.info(foo)
    template syspath do
      source repopath
      variables( :params => foo )
    end
================
So I think there certainly should be some way to access variable.

--
Thanks in advance, Daniil.


пятница, 7 ноября 2014 17:22 Daniil S < > писал(а):


Hello.

I would be grateful if you answer a couple questions.

1. Is it possible to access variables defined in one recipe from the other? For example:

cookbooks/cookbook_name/default.rb:
    foo = :bar

cookbooks/cookbook_name/somerecipe.rb:
    template syspath do
      source repopath
      variables( :params => foo )
    end

2. Is it possible to load attributes from files located in subdirectory of attribute folder? For example:

cookbooks/
|-cookbook_name/
||-attributes/
||-default.rb
|||-attribute_folder1/
||||-one_more_attribute_file.rb
|||-attribute_folder2/
||||-one_more_attribute_file.rb

--
Thanks in advance, Daniil.






Archive powered by MHonArc 2.6.16.

§