On Wednesday, April 23, 2014 11:41:22 AM UTC-5, Jon Forrest wrote:
>
> On Wed, Apr 23, 2014 at 8:54 AM, jcbollinger 
> <john.bo...@stjude.org<javascript:>> 
> wrote: 
> > 
> > 
> > On Tuesday, April 22, 2014 2:16:22 PM UTC-5, Jon Forrest wrote: 
> >> 
> >> So, I explicitly added 
> >> a provider, so that the resource definition is this: 
> >> 
> >>  package { 
> >>     [ "PackageKit"]: 
> >>       provider => 'yum', 
> >>       ensure => absent, 
> >>   } 
> >> 
> >> There was no change!! 
> >> 
> > 
> > 
> > No, because the agent was selecting the yum provider already.  The yum 
> > provider ensures absent by use of 'rpm -e'.  Again, this is intentional. 
>
> Apparently. But still, I was hoping there would be a way to somehow 
> express 
> that I really truly wanted yum to remove a package, the same way it would 
> if I ran yum on the command line. In this case, there are no 
> conflicting resource 
> definitions so there would be no problem with the catalog being 
> consistent. 
>
> My perhaps naive assumption would be that if I explicitly used the 'yum' 
> provider Puppet would follow my direction. I'm clearly wrong. Again, 
> see below. 
>
>

That's not necessarily a naive assumption, but it does suggest that you 
haven't fully grasped the Puppet paradigm.  You seem to be thinking in 
terms of how to persuade Puppet to execute specific commands, but you 
should be thinking in terms of how to accurately express the desired target 
state.  I often describe that issue this way: Puppet is not a script 
engine.  I keep coming back to that because it is a fundamental aspect of 
the Puppet architecture, and you will have the greatest success with Puppet 
if you understand and embrace that.

Given that, then, declaring to Puppet that you want a package "absent" is a 
statement about that package alone.  Declaring that you want it "purged" 
says that you want not only that package absent, but also all its 
configuration files and any other packages that depend on it.

 

> >> In the discussion from 2009, somebody suggested using "purge" instead 
> of 
> >> "absent", 
> >> so I did. 
> > 
> > And if you are willing to accept the risk of inconsistency described 
> above, 
> > then that is what you should do.  But it's spelled "purged", not 
> "purge". 
>
> Oops. You're right. My mistake, although would it be reasonable to expect 
> Puppet to show an error? 
>
>

It *does* show an error, as you reported.  It just does not diagnose the 
problem as misspelled keyword.  It is a slightly quirky but documented and 
long-established feature of the Package provider that you can specify a 
package version as the 'ensure' value to express that that particular 
version should be present.  There is no general standard for package 
version codes, so when you write "ensure => 'purge'" Puppet has no reliable 
way to recognize it as a misspelling -- the problem could instead be that 
you need an additional package repository configured, for example.

 

> So, apart from my stupid syntax error, it seems like my problem was caused 
> by not understanding the difference between "absent" and "purged" when 
> the "yum" provider is used. I just googled 
>
> "puppet difference between purged and absent" 
>
> and I didn't find an explanation. I also checked the Puppet Type 
> Reference manual 
> and I didn't find anything there. Can you point me to anything? 
>
>
Yes.  It is, in fact, in the type reference:
http://docs.puppetlabs.com/references/3.4.stable/type.html#package-provider-yum 



John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5614fb81-020f-4d37-bd52-8cd00df5cb68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to