Package install_options cant handle empty string

asked 2019-01-16 08:56:57 -0600

My puppet code installs an msi with multiple install options that are inserted into a config file.

package {'installer':
    ensure          => installed,
    source          => "${install_tmp_path}/${installer_exe}",
    install_options => [
        {'SMTP_HOST' => $smtp_host},
        {'SMTP_USER' => $smtp_user},
        {'SMTP_PORT' => $smtp_port},
        {'SMTP_PASSWORD' => $smtp_password},
        {'SMTP_SSL' => $smtp_ssl},
        {'SMTP_FROM_ADDRESS' => $smtp_from_address},
        {'SMTP_REPLY_ADDRESS' => $smtp_reply_address}
     require         => File['test']

However if any of these values is an empty string (such as the user or password) then instead of passing in an empty string the next argument is picked up as the value. So for instance instead of:

<add key="SMTPUser" value=""/>
<add key="SMTPPort" value="25"/>

We get:

<add key="SMTPUser" value="SMTP_PORT=25"/>
<add key="SMTPPort" value="*"/>

(The * for port is the default value for the msi if SMTP_Port isnt defined).

What I believe is happening is that when Package translates the code into a command line argument it doesn't wrap the empty string in quotation marks, so it translates to this:


Meaning that cmd determines that the next option is actually the value for SMTP_USER. Instead what it needs to do is this:


Has anyone else seen this problem? Is there a workaround to this? I've tried forcing in quotation marks like so:

{'SMTP_USER' => '\'\''},

However it ends up with double quotation marks:

<add key="SMTPUser" value="''"/> <add key="SMTPPort" value="25"/>

Appreciate any help.

edit retag flag offensive close merge delete


Managed to get around this by doing the install in 'exec' rather than package

welching gravatar imagewelching ( 2019-01-16 12:18:19 -0600 )edit