Skip to content

Commit

Permalink
Fix dependency issues with apt repository
Browse files Browse the repository at this point in the history
This is needed as there is currently no dependency between the
icinga2 packages and Class['apt::update']. This can lead to problems
where the package is installed before apt knowns of the repository.

It also removes the anchor usage of the icinga2::repo class and moves
the dependency management to icinga::repo itself. This is needed as
other modules might also add apt repositories and require
Class['apt::update']. When using the anchor pattern this breaks as
it introduces a dependency cycle.
  • Loading branch information
baurmatt committed Sep 22, 2017
1 parent a7ca9c9 commit f18bad7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,19 @@
-> Concat <| tag == 'icinga2::config::file' |>
~> Class['::icinga2::service']

# Put ::icinga2::repo outside to work around dependency cycle issues with the apt module
include '::icinga2::repo'

anchor { '::icinga2::begin':
notify => Class['::icinga2::service']
notify => Class['::icinga2::service'],
}
-> class { '::icinga2::repo': }
-> class { '::icinga2::install': }
-> File <| ensure == 'directory' and tag == 'icinga2::config::file' |>
-> class { '::icinga2::config': notify => Class['::icinga2::service'] }
-> File <| ensure != 'directory' and tag == 'icinga2::config::file' |>
~> class { '::icinga2::service': }
-> anchor { '::icinga2::end':
subscribe => Class['::icinga2::config']
subscribe => Class['::icinga2::config'],
}

include prefix($features, '::icinga2::feature::')
Expand Down
9 changes: 7 additions & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
gpgcheck => 1,
gpgkey => 'http://packages.icinga.com/icinga.key',
}

Yumrepo['icinga-stable-release'] -> Package<|tag == 'icinga2'|>
}
default: {
fail('Your plattform is not supported to manage a repository.')
Expand All @@ -41,6 +43,7 @@
# handle icinga stable repo before all package resources
# contain class problem!
Apt::Source['icinga-stable-release'] -> Package <| tag == 'icinga2' |>
Class['Apt::Update'] -> Package<|tag == 'icinga2'|>
case $::operatingsystem {
'debian': {
include ::apt, ::apt::backports
Expand Down Expand Up @@ -76,7 +79,7 @@
'suse': {

file { '/etc/pki/GPG-KEY-icinga':
ensure => present,
ensure => file,
source => 'http://packages.icinga.com/icinga.key',
}

Expand All @@ -94,8 +97,10 @@
baseurl => "http://packages.icinga.com/SUSE/${::operatingsystemmajrelease}/release/",
enabled => 1,
gpgcheck => 1,
require => Exec['import icinga gpg key']
require => Exec['import icinga gpg key'],
}

Zypprepo['icinga-stable-release'] -> Package <| tag == 'icinga2' |>
}
default: {
fail('Your plattform is not supported to manage a repository.')
Expand Down

0 comments on commit f18bad7

Please sign in to comment.