Hi Thomas,

On Thu, Sep 27, 2012 at 12:59 PM, Thomas Bendler
<thomas.bend...@gmail.com> wrote:
> Hi @all,
>
> does anyone manage the NSClient++ deployment with puppet? I have the strange
> behavior that I can distribute the installation package to the target server
> and install the package with the MSI provider. The relevant code is here:
>
>   if $windows {
>     file {
>       "c:/local/source":
>       ensure => directory, mode => 0770,
>       owner => "Administrators", group => "Administrators";
>
>       "c:/local/source/NSClient++-0.3.9-x64.msi":
>       ensure => present, mode => 0660,
>       owner => "Administrators", group => "Administrators",
>       require => File["c:/local/source"],
>       path => $::operatingsystem ? { default =>
> "c:/local/source/NSClient++-0.3.9-x64.msi" },
>       source => "puppet:///modules/monitor/nagios/NSClient++-0.3.9-x64.msi";

This require shouldn't be necessary as the file will autorequire its
ancestor directories.

>
>       "c:/local/nsclient/boot.ini":
>       ensure => present, mode => 0664,
>       owner => "Administrators", group => "SYSTEM",
>       require => Package["NSClientpp"],
>       notify => Service["NSClientpp"],
>       path => $::operatingsystem ? { default => "c:/local/nsclient/boot.ini"
> },
>       content => template("monitor/nagios/client/boot.ini.erb");
>
>       "c:/local/nsclient/nsc.ini":
>       ensure => present, mode => 0664,
>       owner => "Administrators", group => "SYSTEM",
>       require => Package["NSClientpp"],
>       notify => Service["NSClientpp"],
>       path => $::operatingsystem ? { default => "c:/local/nsclient/nsc.ini"
> },
>       content => template("monitor/nagios/client/nsc.ini.erb");
>     }
>
>     package {
>       "NSClientpp":
>       ensure => installed,
>       provider => "msi",
>       source => 'c:\local\source\NSClient++-0.3.9-x64.msi',
>       install_options => {
>         'INSTALLLOCATION' => 'c:\local\nsclient',
>         'ADDLOCAL' => 'ALL',
>         'START_SERVICE_ON_EXIT' => '1'
>       };
>     }
>
>     service {
>       "NSClientpp":
>       name => $::operatingsystem ? { default => "NSClientpp" },
>       ensure => "running", enable => true,
>       require => Package["NSClientpp"];
>     }
>   }
>
> Now to the strange thing, when the package is installed with the MSI
> provider, the service entry from the NSClient++ disapear. When I manually
> execute the installation package with option repair, it apears again ...
> until the next puppet run where it disapear again. So calling the service
> resource fail because of the missing service entry. The OS is a 2003SP2 x64,
> the puppet client has the version 2.7.19. Any ideas?

The name of the package needs to match the "DisplayName" as specified
in the registry (and Add/Remove Programs). This used to be in the
puppet wiki page, but I don't see it in the new documentation. I'll
file a doc bug about this.

For this package, it should be "NSClient++ (x64)", both in the package
resource and the service resource that requires it.

It appears what is occurring is that the second time puppet runs, it
thinks the package is not installed, so it installs it again (really a
repair). For some reason, the NSClient MSI gets confused and
uninstalls the service during the repair.

In any case, the second time you run puppet (with --debug), you should
see something like:

Debug: /Stage[main]//File[c:/local/nagios/NSClient++-0.3.9-x64.msi]/require:
requires File[c:/local/nagios]
Debug: /Stage[main]//Service[NSClientpp]/require: requires
Package[NSClient++ (x64)]
...
Debug: Prefetching msi resources for package
Debug: Service[NSClientpp](provider=windows): Service NSClientpp is running
Debug: Service[NSClientpp](provider=windows): Service NSClientpp start
type is auto start

But you should not see:

Debug: Executing 'msiexec.exe /qn /norestart /i
c:\local\nagios\NSClient++-0.3.9-x64.msi ADDLOCAL=ALL
INSTALLLOCATION=c:\local\nsclient START_SERVICE_ON_EXIT=1'

Josh

-- 
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 puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to