3

I'm attempting to use Puppet to install an application that requires parameters to be passed to the underlying MSI is a specific way.

Example:

package { 'Vendor Application':
  ensure => '8.4.12.0',
  source => 'C:\setup.exe',
  install_options => '/S /v"REBOOTPROMPT=Supress"'
}

I've noticed that it doesn't matter if I use double quotes for the install_options and escape the inner double quotes or user single quotes, it appears that each time Puppet is adding a slash in front of the double quote.

See below from the --debug output after running "puppet apply test.pp"

Debug: Executing: 'cmd.exe /c start "puppet-install" /w "C:\setup.exe" "/S /v\"REBOOTPROMPT=Supress\""'

Has anyone else encountered this and figured out how to prevent the extra slash from being added?

Thanks!

1 Answers1

1

Puppet automatically adds quotes when there are spaces in install_options. This is by design. However this is quite undesirable when you want to control exactly how the input is passed, which is nearly every time you are using install_options. Due to the auto-quoting, it is adding \ to escape the existing quotes, which is also an undesirable behavior when it comes to Windows.

So your resource here:

package { 'Vendor Application':
  ensure => '8.4.12.0',
  source => 'C:\setup.exe',
  install_options => '/S /v"REBOOTPROMPT=Supress"'
}

Should be passed like:

package { 'Vendor Application':
  ensure          => '8.4.12.0',
  source          => 'C:\setup.exe',
  install_options => ['/S', '/v"REBOOTPROMPT=Suppress"'],
}

Formatting fixes are not required, but follow the Puppet Style Guide. Also fixed a typo (REBOOTPROMPT=Suppress).

Moreover, it's likely you will need to set it like this as it will be passed through cmd.exe /c (as you've seen above):

package { 'Vendor Application':
  ensure          => '8.4.12.0',
  source          => 'C:\setup.exe',
  install_options => ['"', '/S', '/v""REBOOTPROMPT=Suppress""', '"'],
}

If you really want an in depth understanding of how to determine to pass install_options, read install options with quotes or spaces (it applies to any use of install_options, not just with the provider mentioned).