0

I am new to the chef framework. I want to keep some of my data values such as shared location path, username, password in databag (without encrypting) and refer them in a recipe rather than hard coding them, but when I refer to them in the recipe, the reference is not getting evaluated.

Please find below the script sample I used:

databag details: databag name = ak-databag
             databag_item name= uncpath

databag entries-     id: uncpath
         unc-path: \\ec2-999-333-111-444.ap-southeast-1.compute.amazonaws.com\share

script:
 batch "Copy_product1_and_product2"
  code <<-EOH
            net use "my_bag["unc-path"]" password /user:username
            xcopy "my_bag["unc-path"]\\product1.exe"  "C:\\my-Package1" /y /S
            xcopy "my_bag["unc-path"]\\product2.exe"  "C:\\my-Package2" /y /S
           EOH
end
admdrew
  • 3,790
  • 4
  • 27
  • 39
Goutam
  • 1
  • Did you call something like `my_bag=data_bag_item("ak-databag","uncpath")`before ? (not show in your exemple). Your main problem is probably interpolation i.e: `net use "my_bag["unc-path"]"`should be `net use "#{my_bag['unc-path']}"` – Tensibai Sep 04 '14 at 13:46
  • yes its all about missed '#', thanks a lot for quick response! – Goutam Sep 05 '14 at 11:22

0 Answers0