0

I need to install some product using Puppet on Windows. I use exec recource

exec { 'install':
            command => 'C:\\windows\system32\cmd.exe /c "c:\\Program Files\\zabbix_agentd_64.exe --config c:\\Program Files\\zabbix_agentd.conf --install"',
            }

Syntax is ok, but I get

'c:/Program' is not recognized as an internal or external command

I tried also command => 'C:\\windows\system32\cmd.exe /c "c:\Program Files\zabbix_agentd_64.exe --config c:\Program Files\zabbix_agentd.conf --install"' and command => 'C:\\windows\system32\cmd.exe /c "c:\\Program/Files\\zabbix_agentd_64.exe --config c:\\Program/Files\\zabbix_agentd.conf --install"' but it says syntax error (rightly in fact). Any ideas?

mila002
  • 327
  • 3
  • 14

1 Answers1

2

Puppet (probably the Ruby underneath, actually) is splitting your command string into words without regard to the internal quotes. I don't think there is anything you can do to prevent that, but there is a related issue in Puppet's bug tracker. You could consider commenting on / voting up that issue. It should be possible to specify the command to the Exec in word-split form, as an array, which would provide a solution for your problem.

I see two possible alternatives to get it working now:

  • Use the 8.3 name for the directory (see how to get DOS path instead of Windows path). This may be tricky, because I don't think the 8.3 path is uniquely determined by the file name alone -- it may be affected by the names of sibling files and directories.

  • Specify a PATH for the Exec by which the desired executable can be found, and run it by its simple name.

Community
  • 1
  • 1
John Bollinger
  • 160,171
  • 8
  • 81
  • 157
  • Thank you for your replay John. DOS path works, but specifying a path for exec doesn't, I've tried it before. Writing manifests in Puppet on Windows I've descovered a lot of bugs, this is very ragged tool on this OS... Interesting is that using Windows path for directories with spaces in eg. file or service resources works perfectly. – mila002 May 22 '17 at 12:44