Break extrepo dependency loop

This breaks the dependency loop introduced earlier on.

Change-Id: I2a943a7759152a37c42281fab8e7046125a42b20
This commit is contained in:
Thomas Goirand 2021-05-17 21:37:58 +02:00
parent db3335ca96
commit 600175a415
2 changed files with 24 additions and 13 deletions

View File

@ -72,14 +72,23 @@ class openstack_extras::repo::debian::debian(
# Also, using apt-key is now deprecated (to be removed in 2021).
# We use ensure_packages to avoid conflict with any other class
# external to this module that may also install extrepo.
ensure_packages(['extrepo',], {'ensure' => 'present'})
# We cannot use package{} or ensure_packages[] as per below,
# because this introduces a dependency loop later on if
# $package_require is set to true.
# So please leave this commented.
#ensure_packages(['extrepo',], {'ensure' => 'present'})
exec { "/usr/bin/extrepo enable openstack_${lowercase_release}":
command => "/usr/bin/extrepo enable openstack_${lowercase_release}",
command => "/bin/true # comment to satisfy puppet syntax requirements
apt-get update
apt-get install -y extrepo
extrepo enable openstack_${lowercase_release}
apt-get update
",
logoutput => 'on_failure',
tries => 3,
try_sleep => 1,
require => Package['extrepo'],
creates => "/etc/apt/sources.list.d/extrepo_openstack_${lowercase_release}.sources",
}
if $package_require {

View File

@ -24,11 +24,12 @@ describe 'openstack_extras::repo::debian::debian' do
context 'with default params' do
it { should contain_exec('/usr/bin/extrepo enable openstack_victoria').with(
:command => '/usr/bin/extrepo enable openstack_victoria',
)}
it { should contain_package('extrepo').with(
:ensure => 'present',
:name => 'extrepo',
:command => "/bin/true # comment to satisfy puppet syntax requirements
apt-get update
apt-get install -y extrepo
extrepo enable openstack_victoria
apt-get update
",
)}
end
@ -40,11 +41,12 @@ describe 'openstack_extras::repo::debian::debian' do
}
end
it { should contain_exec('/usr/bin/extrepo enable openstack_wallaby').with(
:command => '/usr/bin/extrepo enable openstack_wallaby',
)}
it { should contain_package('extrepo').with(
:ensure => 'present',
:name => 'extrepo',
:command => "/bin/true # comment to satisfy puppet syntax requirements
apt-get update
apt-get install -y extrepo
extrepo enable openstack_wallaby
apt-get update
",
)}
end