Debugging which provider and which command it is using

18 views
Skip to first unread message

huhm4n

unread,
Oct 27, 2014, 2:28:25 PM10/27/14
to puppet...@googlegroups.com
When I'm installing some package using puppet, let's say


package { "xxx":
     ensure => present,
            }

How do I include if it is running yum install, or apt-get when I'm pushing this module on os level? 

I want to have output like,

using yum install xx or something like that if it is running on rhel boxes, I couldn't make it work? Any ideas? Thanks in advance.

Sam Coffland

unread,
Oct 28, 2014, 1:14:43 AM10/28/14
to puppet...@googlegroups.com
I'm not sure exactly what your trying to achieve by getting the provider but I give it a shot at it anyway. 

In order to get debugging info from puppet you would use a notice. http://www.puppetcookbook.com/posts/simple-debug-messages.html

So if you wanted to have your EL systems tell you they installed a package with yum and you Debian systems to tell you they installed it with apt-get try. 

package { "foo":
   ensure => present,
}
if osfamily == "RedHat" {
   notify { 'Installed with Yum': 
      require =>Package['foo'],
}

if osfamily == "Debian" {
   notify { 'Installed with apt-get': 
      require =>Package['foo'],
}

Hope this helps. 

jcbollinger

unread,
Oct 28, 2014, 9:21:53 AM10/28/14
to puppet...@googlegroups.com


On Monday, October 27, 2014 1:28:25 PM UTC-5, huhm4n wrote:
When I'm installing some package using puppet, let's say


package { "xxx":
     ensure => present,
            }

How do I include if it is running yum install, or apt-get when I'm pushing this module on os level? 


The idea is that Puppet is supposed to figure out for itself which provider to use, at least for packages of the system's native type.  You can specify a particular provider via the Package type's 'provider' parameter, but usually you should just let Puppet pick.  It does a good job of it.

 

I want to have output like,

using yum install xx or something like that if it is running on rhel boxes, I couldn't make it work? Any ideas? Thanks in advance.

 
If you run the agent with '--debug' output enabled then the output will contain, among other things, the commands used to sync each resource.


John

Reply all
Reply to author
Forward
0 new messages