Require on class not working, class parrtitly applied.

asked 2017-06-12 07:59:43 -0600

sirhopcount gravatar image

Hi.

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 {

  package{ 'cowsay':
  ¦ 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

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

Comments

k sry but it does seem weird because your relationships seem to be right. Can you maybe do an agent run with the --graph option to see if there is maybe something we missed. This should create three .dot files in your states folder: $vardir/graphs/

negast gravatar imagenegast ( 2017-06-14 04:02:24 -0600 )edit