Hi,
Using a library helper method inside a resource code block leads to a NoMethodError:
NoMethodError
-------------
undefined method `vra_icd_environment' for Chef::Resource::PowershellScript
Relevant File Content:
----------------------
C:/chef/cache/cookbooks/VRA_itcam/recipes/win_itcam_install.rb:
114: powershell_script 'Run_itcam_account_script' do
115: code <<-EOH
116: Set-Location #{node['itcam']['win-tmp-folder-name']}
117>> .\\#{node['itcam']['account-script']} #{vra_icd_environment}
118: EOH
119: returns [0, 1]
120: end
I tried several ways to qualify the method, to no avail
NoMethodError
-------------
undefined method `vra_icd_environment' for VraItm::Helper:Module
...
117>> .\\#{node['itcam']['account-script']} #{VraItm::Helper::vra_icd_environment}
NoMethodError
-------------
undefined method `vra_icd_environment' for VraItm::Helper:Module
...
117>> .\\#{node['itcam']['account-script']} #{VraItm::Helper.vra_icd_environment}
I had to assign the method return value to a local variable and use that variable inside the resource block. I'd like to do away with this intermediate step.
Is is possible to reference a cookbook library helper method inside a resource block?