0

I'm trying to get Puppet to manage my Debian apt sources.list, however, catalog compilation fails with this error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: ::apt::config_files is not a hash or array when accessing it with list at /etc/puppet/environments/production/modules/apt/manifests/setting.pp:45 on node [hostname]

I have no idea where I should provide ::apt::config_files or what I'd need to put in it. My manifests contain the following:

# site.pp
node <hostname> {
  include roles::myrole
}

# myrole.pp
class roles::myrole.pp {
  include profiles::apt
}

# apt.pp
class profiles::apt {

  # Get our apt sources out of Hiera.
  $hiera_apt_sources = hiera_hash(apt_sources)

  # Create our apt sources.
  create_resources(apt::source, $hiera_apt_sources)

}

# hieradata (yaml)
apt_sources:
  'debian_stable':
    location: 'ftp.be.debian.org/debian/'
    release: 'stable'
    repos: 'main contrib non-free'
  'debian_security':
    location: 'security.debian.org'
    release: 'updates'
    repos: 'main contrib non-free'

Am I missing something obvious here? I've looked through the documentation at the forge and this Puppetlabs post and some other hits on Google.

I also tried to include apt in apt.pp, but to no avail.

Simon
  • 193
  • 2
  • 10

1 Answers1

0

It turns out namespacing was the problem.

In order for this to work I need the MODULE 'apt' to be called. By specifying include apt or class { 'apt': } in the class profiles::apt, it tries to include or call itself. Changing to class { '::apt': } (absolute name) fixes the problem.

Simon
  • 193
  • 2
  • 10