Hi,

Excerpts from Martijn Grendelman's message of Tue Aug 31 16:02:43 -0400 2010:
> Hi Nigel Kersten,
> 
> >> What I would like, is for Puppet to run `aptitude update` before it
> >> installs or upgrades packages. That doesn't seem out of the ordinary to
> >> me, but I can't make it work in Puppet.
> >>
> >> The approach I like best, is this one:
> >>
> >>    class apt-update {
> >>        exec { "/usr/bin/aptitude update":
> >>            refreshonly => true,
> >>        }
> >>    }
> >>
> >>    define apt_package($ensure="latest") {
> >>        include apt-update
> >>        package { $name:
> >>            ensure  => $ensure,
> >>            require => Class["apt-update"],
> >>        }
> >>    }
> >>
> >>    apt_package { "foo":
> >>    }
> >>
> >> but that doesn't work, it doesn't run apt-update before installing 'foo',
> >> because of the "refreshonly => true". If I remove it, it works, but then
> >> `aptitude update` is run on /every/ Puppet run, which is worse than not
> >> running it at all.
> >>
> >> Is it at all possible to achieve what I want with Puppet? If so, how?
> > 
> > Why do you want to run this before every package install? That will
> > add a fair bit of overhead. I don't quite understand the desire to run
> > before every package install, and yet not simply have it run once
> > before all package installs.
> 
> I am not sure how I said I want to do an update before /every/ package
> install. Once at the start of a Puppet-run, /IF/ one or more packages
> need to be installed, would suffice.
>

You may run into a chicken-egg problem. Packages that are configured as
"ensure => latest" can only be upgraded by puppet if the local apt cache
files are up-to-date. 

IOW puppet relies on the local apt files to figure out if packages need
to be updated. And to get new local apt files apt-get update needs to be
run.

-- 
Mathias Gug
Ubuntu Developer  http://www.ubuntu.com

-- 
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