Re: [Puppet Users] Puppet + APT, I am lost...

Martijn Grendelman
Tue, 07 Sep 2010 09:35:55 -0000

Hi,

Just to let you know how I implemented it in the end. Earlier I wrote:

> I have now solved my problem by using a custom provider for packages, that
> is based on the aptitude provider, but simply adds this:
>
> # See if we need to run aptitude update before installing this package
> if not File.exists?("/tmp/puppet-iphionapt")
>   FileUtils.touch("/tmp/puppet-iphionapt")
>   aptitude("update")
> end
>
> I just haven''t found a suitable way to clean up the tempfile from
within
> Puppet without touching any of Puppet''s own files, so I use a
cronjob for
> that now. Maybe I''ll switch to a
''postrun_command'', or does anyone have a
> better idea?

I have put the custom package provider in a module. This module also has a
''cleanup'' class, that removes the tempfile. The cleanup class
is run in a
''post'' runstage. The custom provider is used by default for
all packages.

On the first package install, aptitude update is run, but not for
subsequent installs in the same run. At the end of the run, the tempfile
is removed.

Best regards,
Martijn.