moving from previous manual install to puppet/chocolatey

388 views
Skip to first unread message

Jay Benner

unread,
Feb 12, 2014, 10:37:49 PM2/12/14
to puppet...@googlegroups.com
I have a bunch of windows servers with NewRelic installed on them and I want to start managing those installs with Puppet.  Seemed like the thing to do would be to have chocolatey uninstall what is there and reinstall within the framework of chocolatey so that I get addressable version information and the like.  I created the following chocolatey package and it works fine when run from the command line using cinst: any existing version is removed and the new version, managed by chocolatey, gets put in its place.  However, when I run it from Puppet, it does the uninstall ok, but the install never happens, even though chocolatey seems to think that the package is installed. 


stop-service "LiveVault Backup Service"
$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -match "New Relic Server Monitor" 
}

$app.Uninstall()
$licensekey = "XXXXXXXXXXXXXX"

$packageName = 'NewRelic_ServerMonitor'
$installerType = 'MSI' 
$url = 'http://download.newrelic.com/windows_server_monitor/release/NewRelicServerMonitor_x86_2.0.0.198.msi'
$url64 = 'http://download.newrelic.com/windows_server_monitor/release/NewRelicServerMonitor_x64_2.0.0.198.msi' 
$validExitCodes = @(0
$silentArgs = "/L*v install_Agent.log /qn NR_LICENSE_KEY=`"$licensekey`"" 
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64"  -validExitCodes $validExitCodes

start-service "LiveVault Backup Service"
Start-service "New Relic Server Monitor"

Rob Reynolds

unread,
Feb 13, 2014, 3:43:40 PM2/13/14
to puppet...@googlegroups.com
This is the chocolateyInstall.ps1 file, correct?  This email may be better directed towards the chocolatey google group instead as we handle chocolatey (and the chocolatey puppet provider) questions over there (a thought for next time - I can cross post this message over there when we are done).

What version of the provider are you using? Is it the one off of the forge or off of GitHub?

What version of chocolatey are you using on the server?

What is the name of your custom package?

When you log into the server in question, do you see the package in c:\chocolatey\lib ?

UAC is on or off on this server? 

There may also be something in the difference between the x86/x64 runtimes but it seems unlikely right now. 


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/56fe586f-6c6e-49fb-a432-3a814ac3e65e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Rob Reynolds
Developer, Puppet Labs

Join us at PuppetConf 2014September 23-24 in San Francisco - http://bit.ly/pupconf14

Jay Benner

unread,
Feb 13, 2014, 4:55:22 PM2/13/14
to puppet...@googlegroups.com
I got it from the forge.
I don't know how to tell what version of chocolatey I have.
Name of the package is "newrelic_servermonitor".
The package does appear in /lib, even though the software did not install.
UAC is off.
Thanks for the response, I posted in Puppet because it seems to work perfectly when I run chocolatey from the command prompt.  I didn't realize that the chocolatey group supported the puppet provider as well; I'll note it in the future.

Rob Reynolds

unread,
Feb 13, 2014, 5:18:59 PM2/13/14
to puppet...@googlegroups.com
Can you share your manifest?

Also would you run puppet agent --test --verbose --debug and post that output (preferably in a gist / pastebin and then link that here)? Remove the sensitive information such as the license.


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Rob Reynolds

unread,
Feb 13, 2014, 5:19:32 PM2/13/14
to puppet...@googlegroups.com
You may need to remove the package folder from c:\chocolatey\lib first.

Jay Benner

unread,
Feb 13, 2014, 6:22:17 PM2/13/14
to puppet...@googlegroups.com
The results of the test run:
http://pastebin.com/00msu7VB

My manifest:
# Class: newrelic_server_monitor
#
# This module manages newrelic_server_monitor

class newrelic_server_monitor {
 
  #check installed version and remove if it is older than 2.0.0.198
  case
 
$pkg = 'NewRelic_Servermonitor'

      package { $pkg:
        ensure          => installed,
        provider        => 'chocolatey',
        source  =>  '\\myfileserver\everyone\devops\chocolatey\packages',

Rob Reynolds

unread,
Feb 13, 2014, 7:17:35 PM2/13/14
to puppet...@googlegroups.com
Did you have the package in C:\chocolatey\lib already? It will not attempt to install if it finds a package with the same name

Also you may want to switch to ensure => latest.



For more options, visit https://groups.google.com/groups/opt_out.

Jay Benner

unread,
Feb 13, 2014, 8:10:36 PM2/13/14
to puppet...@googlegroups.com
I had deleted the entry in /lib.


On Wednesday, February 12, 2014 2:37:49 PM UTC-8, Jay Benner wrote:

Rob Reynolds

unread,
Feb 14, 2014, 5:58:53 PM2/14/14
to puppet...@googlegroups.com
I looks like it does install the package, but may be running into something else when it is running. In C:\chocolatey\chocolateyInstall there are some log files, what does the log file say about the installation?


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Jay Benner

unread,
Feb 14, 2014, 6:47:08 PM2/14/14
to puppet...@googlegroups.com
The following is a copy of my log:
http://pastebin.com/wz5peZbG
Looks like the download failed.  Perhaps a problem with puppet not being able to access my personal temp folder?

Rob Reynolds

unread,
Feb 14, 2014, 6:53:17 PM2/14/14
to puppet...@googlegroups.com
You are running into an issue we have seen but have not been able to reproduce effectively - https://github.com/chocolatey/puppet-chocolatey/issues/18



For more options, visit https://groups.google.com/groups/opt_out.

Rob Reynolds

unread,
Feb 14, 2014, 6:55:51 PM2/14/14
to puppet...@googlegroups.com
Let's have you upgrade chocolatey to 0.9.8.23 and see if the issue still happens. The paste bin shows 0.9.8.20.

Jay Benner

unread,
Feb 14, 2014, 9:33:29 PM2/14/14
to puppet...@googlegroups.com
Some improvement.  I'll attach another chocolateyinstall log below.  It still didn't install the agent, but it also didn't add an entry to /lib, so I'm guessing it will keep trying.  Looks like the same error downloading the file.

http://pastebin.com/BFd90qkb

Rob Reynolds

unread,
Feb 14, 2014, 9:57:12 PM2/14/14
to puppet...@googlegroups.com
It looks to be a possible bug in the chocolatey provider that happens when we try to capture both error and regular logging when an error has occurred. Keep a watch on the issue itself for updates.

In the meantime if you are using SYSTEM for the puppet agent, I would switch to something with network access and see if chocolatey works inside of puppet.



For more options, visit https://groups.google.com/groups/opt_out.

Jay Benner

unread,
Feb 14, 2014, 10:20:35 PM2/14/14
to puppet...@googlegroups.com
I ran it as me and it behaved the same.

Jay Benner

unread,
Feb 17, 2014, 7:11:25 PM2/17/14
to puppet...@googlegroups.com
If I am going to use the workarounds mentioned in the bug article you referenced, should I put that code into chocolateyinstall.ps1?


On Friday, February 14, 2014 1:57:12 PM UTC-8, Rob Reynolds wrote:

Jay Benner

unread,
Feb 17, 2014, 8:57:22 PM2/17/14
to puppet...@googlegroups.com
I tried them in chocolatey.ps1, but that just seemed to break chocolatey.

Rob Reynolds

unread,
Feb 18, 2014, 4:03:45 PM2/18/14
to puppet...@googlegroups.com
On Mon, Feb 17, 2014 at 2:57 PM, Jay Benner <long...@gmail.com> wrote:
I tried them in chocolatey.ps1, but that just seemed to break chocolatey.


On Monday, February 17, 2014 11:11:25 AM UTC-8, Jay Benner wrote:
If I am going to use the workarounds mentioned in the bug article you referenced, should I put that code into chocolateyinstall.ps1?

Those workarounds will likely need to go back into chocolatey or the provider itself. It seems to be running into some error but once it tries to write the error it runs into the issue you are running into, making the error harder to find. 
 

For more options, visit https://groups.google.com/groups/opt_out.

Jay Benner

unread,
Feb 18, 2014, 6:10:41 PM2/18/14
to puppet...@googlegroups.com
PS - This system that I am working on is very much a test system, so we can try whatever we want on it.  It is representative of a lot of other systems on my network, though, so I do need to land on a semi-elegant solution at some point.

Rob Reynolds

unread,
Feb 18, 2014, 6:26:15 PM2/18/14
to puppet...@googlegroups.com
On Tue, Feb 18, 2014 at 12:10 PM, Jay Benner <long...@gmail.com> wrote:
PS - This system that I am working on is very much a test system, so we can try whatever we want on it.  It is representative of a lot of other systems on my network, though, so I do need to land on a semi-elegant solution at some point.

Ah fantastic. Let's hope I can get the provider to stop throwing that error sometime this week or next. Would that be within your range of needing a solution?
 

For more options, visit https://groups.google.com/groups/opt_out.

Jay Benner

unread,
Feb 18, 2014, 7:41:09 PM2/18/14
to puppet...@googlegroups.com
Thats cutting it pretty close for me.  I am preparing for a pretty high profile demo to some execs next Wednesday.  I'll need at least a day to test it out.  I don't think I'll be fired if I'm not ready to demo this module, but it would really help me evangelize the product against a high profile issue.
Reply all
Reply to author
Forward
0 new messages