Hi Justing,
On Mon, Sep 24, 2012 at 11:28 PM, Justin Brown
<[email protected]> wrote:
> Nan,
>
> Thanks for the reply. That's certainly what the code and doc string
> indicate. However, I think that I may have encountered a Puppet bug, but I
> don't know enough Ruby to troubleshoot much.
>
> Here's my new resource:
>
> package { "my_problematic_package.msi":
> ensure => present,
> provider => 'msi',
> install_options => ['/quiet', '/passive'],
> source => "C:/packages/my_problematic_package.msi",
> require => File["C:/packages/my_problematic_package.msi"],
> }
>
> err: /Stage[main]/Sia/Package[my_problematic_package.msi]/ensure: change
> from absent to present failed: Could not set 'present on ensure: undefined
> method `include?' for nil:NilClass at
> /etc/puppet/modules/sia/manifests/init.pp:71
>
> The close brace for the package resource is at line 71.
>
> I seems to be that the bug has to be at line 129 or 149 in package.rb, but I
> ran added some debug statements, and neither "include?" statement is run.
>
> I'm not sure where to go from here. I suppose that using exec will be the
> most expedient, but I'd also like some help on troubleshooting this problem,
> so I can properly report it.
>
> Thanks,
> J
>
> On Mon, Sep 24, 2012 at 9:10 PM, Nan Liu <[email protected]> wrote:
>>
>> On Mon, Sep 24, 2012 at 5:22 PM, jbrown <[email protected]> wrote:
>> > Hello,
>> >
>> > I'm trying to install a few MSI packages on Windows, and I'm having
>> > trouble
>> > specifying options.
>> >
>> > Here is what I want to execute
>> >
>> > C:\packages\my_problematic_package.msi \quiet \passive
>> >
>> > As you can see, I'm trying to specify two arguments to the package, but
>> > I
>> > can't figure out how to use the Puppet package resource to accomplish
>> > this.
>> > Install_options being a hash is causing me confusion.
>> >
>> > Here's my attempt at a resource definition:
>> >
>> > package { "my_problematic_package.msi":
>> > ensure => installed,
>> > provider => 'msi',
>> > source => "C:/packages/my_problematic_package.msi",
>> > install_options => '/quiet /passive',
>> >
>> > # Previous try as a hash
>> > # install_options => { " " => '/quiet /passive' },
>> >
>> > require => File["C:/packages/my_problematic_package.msi"],
>> > }
>> >
>> > When I run this on the a Windows host, I get a help popup (same thing
>> > without any install_options defined) that is the same as running '\?'.
>> > Then,
>> > I get an error that says "the semaphore cannot be set again." Thinking
>> > that
>> > Puppet may think the package is installed, I re-ran it with "ensure =>
>> > absent," which succeeded, but subsequent install attempts failed with
>> > the
>> > same error.
>> >
>> > The MSI is obviously executing because the help popup appears. It just
>> > seems
>> > to be running with the incorrect options.
>> >
>> > Could anyone help?
>>
>> Looking at the code it's expecting an array (of string or hash). I'm
>> not sure why the docs on the website shows just a hash, since the type
>> is not doing munging.
>>
>> install_options => ['\quiet', '\passive'],
>>
>> Might be a recent change, anyhow take a look at the inline
>> documentation in the source code:
>>
>> https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/package.rb#L301
>>
>> Thanks,
>>
>> Nan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
The `install_options` package parameter in 2.7.x was intended to be
used for specifying MSI public properties. For example, from the
reference documentation for install_options[1]:
package { 'mysql':
ensure => installed,
provider => 'msi',
source => 'N:/packages/mysql-5.5.16-winx64.msi',
install_options => { 'INSTALLDIR' => 'C:\mysql-5.5' },
}
The msi package provider will transform the hash pair into
INSTALLDIR='c:\mysql-5.5' on the command line, and will automatically
quote either the key or value if it contains spaces -- to handle
things like INSTALLDIR='c:\Program Files\Vendor\Application'
In 3.0 the `install_options` parameter has been extended to allow
single valued arguments. So you can specify things like:
package { 'mysql':
ensure => installed,
source => 'N:/packages/mysql-5.5.16-winx64.msi',
install_options => [ '/S', { 'INSTALLDIR' => 'C:\mysql-5.5' } ],
}
Note the array, which contains a single string followed by a hash
pair. This will become `/S INSTALLDIR='C:\mysql-5.5'` on the command
line.
I recommend giving the 3.0rc7 release a try[2]. It supports both MSI
and executable installers on Windows, and you can specify
uninstall_options for Windows package resources (in the same format as
install_options).
Josh
[1] http://docs.puppetlabs.com/references/2.7.19/type.html#package
[2] https://groups.google.com/forum/?fromgroups=#!topic/puppet-users/BCyRtDcqeBY
--
Josh Cooper
Developer, Puppet Labs
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.