debug puppet agent

44 views
Skip to first unread message

Tiemen Ruiten

unread,
Nov 14, 2014, 6:21:04 AM11/14/14
to puppet...@googlegroups.com


Hello,

This is my first post on this group, so apologies if this has been asked before.

I'm trying to debug why a puppet agent on a Windows 7 node is not doing what I think it's supposed to be doing:

I have installed the rismoney-chocolatey and puppetlabs-powershell providers and have two classes, packages::chocolatey and packages::workstation.

in /etc/puppet/environments/common/packages/manifests/chocolatey.pp

class packages::chocolatey {
  exec { "install-chocolatey":
    creates  => 'C:\ProgramData\chocolatey',
    provider => 'powershell',
    command  => 'iex ((new-object net.webclient).DownloadString(\'https://chocolatey.org/install.ps1\'))',
  }
}

This one works fine.

and in /etc/puppet/environments/common/packages/manifests/workstation.pp

class packages::workstation {

  package {
    'vlc':              ensure  => 'installed',
    'notepadplusplus':  ensure  => 'installed',
  }
}

This one doesn't work. The puppet agent runs without error, but the two packages are not installed! So I'm trying to find out what exactly puppet is doing, for example the output of the choco command that it's supposed to execute. I'm having a really hard time though finding any documentation or debug logging. How can I see what puppet is doing when it's running? I have attached the output of puppet --debug --onetime


puppet.txt

Josh Cooper

unread,
Nov 14, 2014, 12:43:17 PM11/14/14
to puppet...@googlegroups.com
Are you sure that class is included in the catalog, it doesn't appear puppet ever tries to install those packages.

Also on windows the default package provider is `windows`, so to use chocolatey, you need to specify `provider => chocolatey` in your package resource or create a resource default.

Also, you'll want to make sure that your package resource requires the 'install-chocolatey' exec, so that those steps are performed in the correct order.
 



--
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/48f94cf0-0046-46a2-88b8-a4232c444f96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Josh Cooper
Developer, Puppet Labs

Join us at PuppetConf 2015, October 5-9 in Portland, OR - http://2015.puppetconf.com.  
Register early to save 40%!

Felix Frank

unread,
Nov 14, 2014, 1:34:31 PM11/14/14
to puppet...@googlegroups.com
On 11/14/2014 06:42 PM, Josh Cooper wrote:
> This one doesn't work. The puppet agent runs without error, but the
> two packages are not installed! So I'm trying to find out what
> exactly puppet is doing, for example the output of the choco command
> that it's supposed to execute. I'm having a really hard time though
> finding any documentation or debug logging. How can I see what
> puppet is doing when it's running? I have attached the output of
> puppet --debug --onetime
>
>
> Are you sure that class is included in the catalog, it doesn't appear
> puppet ever tries to install those packages.
>
> Also on windows the default package provider is `windows`, so to use
> chocolatey, you need to specify `provider => chocolatey` in your package
> resource or create a resource default.
>
> Also, you'll want to make sure that your package resource requires the
> 'install-chocolatey' exec, so that those steps are performed in the
> correct order.

This.

Also, to do plain old "printf" style debugging, add notify { } resources
to your manifest.

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages