Require on class not working, class parrtitly applied.

asked 2017-06-12 07:51:01 -0600

sirhopcount gravatar image


I've run into a strange issue with class requirements. Puppet needs to add a private repository before it tries to install etcd. I'm using the role/profile setup and the class are defined as follows::

class roles::controlplane {
  include profiles::controlplane

And in this class I include

class profiles::controlplane {

  include profiles::repo

  class {'::etcd':
    require => Class['::profiles::repo']

The etcd class only has a package resource. The repo class is as follows (edit for brevity). I also added the cowsay package for debugging (more on that later)

class profiles::repo {

  ¦ ensure => 'present'

  # Add APT repository
  apt::source { 'repo-ci':
  ¦ comment  => 'Repo CI stable repository',
  ¦ location => "http://repo.domain.tld/repo-${lsbdistcodename}",
  ¦ release  => "repo-${lsbdistcodename}",
  ¦ repos    => 'main',
  ¦ key      => 'XXXXXX'

When I do a puppet run it fails the first run because it tries to install the package before the private apt repo is included. The debug output shows that the cowsay package is being installed before the etcd package so it seems the class is included correctly but for some reason the apt repo isnt added before the etcd package.

What am I missing?

Version info

puppet-agent               1.10.0-1jessie
puppetlabs-release-pc1     1.1.0-2jessie

apt module
puppetlabs-apt (= 4.0.0)

edit retag flag offensive close merge delete