On 18 Nov 2010, at 12:56 AM, Daniel Maher wrote:
> I have run into problems in the past where a package has been added to our 
> yum repository, and a (new) class has been pushed to install that package, 
> but puppet fails because the yum db on the target machine is too stale, and 
> thus isn't aware of the existence of the new package.
> 
> My question is this : what have other Puppet admins done in order to ensure 
> that a target machine has the freshest local dbcache before attempting to 
> install a package ?

We haven't run into this problem here, but I imagine something like the 
following (untested) code might help:

        exec { 'yum-clean-expire-cache':
          user => 'root',
          path => '/usr/bin',
          command => 'yum clean expire-cache',
        }

        Package { require => Exec['yum-clean-expire-cache'] }

        package { ['foo','bar']: ensure => present }

That should make Puppet revalidate all of yum's caches before attempting to 
install either the foo or bar packages (or any packages for which the above 
resource default is in scope).  'yum clean expire-cache' is the cheapest way to 
ensure an updated view of your yum repos, without deleting too much metadata 
which may need re-downloading in case the repos are unchanged.  Note that this 
clean would happen on every Puppet run, of course, and that may not be 
desirable.

-- 
Ian Ward Comfort <icomf...@stanford.edu>
Systems Team Lead, Academic Computing Services, Stanford University

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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