Can we reference resource type as a variable extrapolation


#1

Hi,

I am new to chef and I have a usecase where I am using multiple commands to run against a node. I am using custom resources for that. To give you the problem I am facing is an example recipe below which fail to compile with ruby syntax error:

command=“file”
“#{command}” “#{command}” do
action :nothing
end

/opt/chefdk/embedded/bin/ruby -c default.rb
default.rb:2: syntax error, unexpected keyword_do_block, expecting end-of-input
“#{command}” “#{command}” do

How do I reference a variable name as a resource type ? or is it not possible to do so ?


#2

I think I was looking at wrong way to solve the problem. Found the correct way. Thanks