I'm working with Puppet Agents living inside of Docker containers, so using as little filesystem space as possible is of high importance. Therefore, at the very end of my Docker bulid, I was running the following:
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
The problem is that my Puppet runs try to install a package, and since there are no lists to pull from, it fails. A simple apt-get update
allows everything to run properly.
I'm running the latest Puppet 3 client available from their repository. How can I use stages to require the following wrapping each Puppet run:
- Before anything, run
apt-get update
, only if the Puppet catalog for this instance has changed. (ie: if nothing has changed, don't do anything, don't update, as it's a waste of cycles, bandwidth, resources, etc.) - After everything, run
apt-get clean
to clean everything out and possibly run the equivalent of the DockerRUN
command listed above.
How can I use Puppet execution stages to intelligently wrap the Puppet run, updating apt beforehand and wiping the cache afterward?