mardi 22 mars 2016

referencing an attribute in a windows path string

I have the following execute in chef:

#execute
execute 'service-api install' do
  command 'c:\buildinfo\service-api\api\approot\web-#{node['default']['env']}.cmd'
end

its running in windows and #{node['default']['env']} is an attribute that I am trying to reference in the path string above.

When I run this I get the following error:

> SyntaxError
> ==> default: -----------
> ==> default: C:\vagrant-chef\319622f1791bb50a8f9441fd4c1ff806\cookbooks\djcm_paypal_win\recipes\installService.rb:76:
> syntax error, unexpected tIDENTIFIER, expecting keyword_end
> ==> default: ...api\approot\web-#{node['default']['env']}.cmd'

If I try:

 #execute
    execute 'service-api install' do
      command "c:\buildinfo\service-api\api\approot\web-#{node['default']['env']}.cmd"
    end

The slashes display in a different color(escape character?) and I get the following error:

[execute] The filename, directory name, or volume label syntax is incorrect.
 command "c:\buildinfo ervice-api\api\approotweb-integration.cmd"

So it messes up around slashes but gets the attribute. How can I give an attribute in a string with slashes ?

Aucun commentaire:

Enregistrer un commentaire