[Puppet Users] apt-get update before package installations

Gino Lisignoli
Fri, 30 Mar 2012 01:50:07 -0000

I''m stupidly new to puppet and have taken over someone''s
"in-progress-to-be-completed" implementation of puppet.
I''m trying to see how I can run apt-get update before any package
installs. I''ve googled around found some articles but they
don''t seem to
work (or rather I most likely don''t understand them).

The situation I have is:

Contains our sites
/etc/puppet/manifests/sites.pp
=============================import "classes/*"
import "common"

node "TestBaseServer" {
         include ssh_keys
         include puppet
         include test_apt
         include base_software
         include profile
         include core_servers_software
         include admin_tools
         include core_servers_config
         include build_servers_software
         include exim
}

The basic list of packages to be installed
/etc/puppet/manifest/classes/base_software
=========================================class base_software {
         Package {
                 require =>
[Class[''test_apt''],Class[''apt::update'']]
         }
         package { "debian-keyring": ensure => latest }
         package { "vim": ensure => latest }
         package { "ethtool": ensure => latest }
         package { "tcpdump": ensure => latest }
         package { "rsync": ensure => latest }
}

The class I have create.
/etc/puppet/modules/apt/manifests/update.pp
===========================================define apt::update {
         exec {''/usr/bin/apt-get update'':}
}


root@zvsv02:~# puppetd --test --noop
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Could n
ot find class apt::update at
/etc/puppet/manifests/classes/base_software:6 on no
de zvsv02.opus.co.nz

So what I''m not sure about the current system is while I have defined
the class in /etc/puppet/module/apt/manifests, the file that is trying
to use the defined class is in /etc/puppet/manifests/classes

I''m not really sure exactly how this is supposed to work. If
I''m reading
the documentaton right, then everything in the modules should be self
contained, so I''m guessing calling apt::update from
/etc/puppet/manifests/classes while the class sits in
/etc/puppet/modules/apt won''t work? I can replace the line:
[Class[''test_apt''],Class[''apt::update'']]
With:[Class[''test_apt''],Class[''apt'']] and it
finds the ''apt'' class fine.

I''m confused.