repo: install keyring with an exec

We absolutely need:
Exec['apt_update'] -> Package<||>

To have the right OpenStack packages installed on Ubuntu and Debian.
So rather than installing with a Package resource, let's use an exec so
we are sure 'apt-get update' is run before any Package puppet resource.

Change-Id: Ic99304d546d1153e3244c1191bbfc52c2118dd5f
This commit is contained in:
Emilien Macchi 2015-06-25 20:16:02 -04:00
parent 6feda8b3e9
commit ffb8ff8645
4 changed files with 30 additions and 20 deletions

View File

@ -38,10 +38,15 @@ class openstack_extras::repo::debian::debian(
$package_require = false
) inherits openstack_extras::repo::debian::params {
if $manage_whz {
package { 'gplhost-archive-keyring':
ensure => 'present',
name => $::openstack_extras::repo::debian::params::whz_required_packages,
} ->
exec { 'installing gplhost-archive-keyring':
command => '/usr/bin/apt-get -y install gplhost-archive-keyring',
logoutput => 'on_failure',
tries => 3,
try_sleep => 1,
refreshonly => true,
subscribe => File["/etc/apt/sources.list.d/${::openstack_extras::repo::debian::params::whz_name}.list"],
before => Exec['apt_update'],
}
apt::source { $::openstack_extras::repo::debian::params::whz_name:
location => $::openstack_extras::repo::debian::params::whz_location,
release => $release,
@ -56,7 +61,7 @@ class openstack_extras::repo::debian::debian(
create_resources('apt::source', $source_hash, $source_defaults)
if $package_require and ! $manage_whz {
if $package_require {
Exec['apt_update'] -> Package<||>
}
}

View File

@ -38,10 +38,15 @@ class openstack_extras::repo::debian::ubuntu(
$package_require = false
) inherits openstack_extras::repo::debian::params {
if $manage_uca {
package { 'ubuntu-cloud-keyring':
ensure => 'present',
name => $::openstack_extras::repo::debian::params::uca_required_packages,
} ->
exec { 'installing ubuntu-cloud-keyring':
command => '/usr/bin/apt-get -y install ubuntu-cloud-keyring',
logoutput => 'on_failure',
tries => 3,
try_sleep => 1,
refreshonly => true,
subscribe => File["/etc/apt/sources.list.d/${::openstack_extras::repo::debian::params::uca_name}.list"],
before => Exec['apt_update'],
}
apt::source { $::openstack_extras::repo::debian::params::uca_name:
location => $::openstack_extras::repo::debian::params::uca_location,
release => "${::lsbdistcodename}-updates/${release}",
@ -51,7 +56,7 @@ class openstack_extras::repo::debian::ubuntu(
create_resources('apt::source', $source_hash, $source_defaults)
if $package_require and ! $manage_uca {
if $package_require {
Exec['apt_update'] -> Package<||>
}
}

View File

@ -46,7 +46,7 @@ describe 'openstack_extras::repo::debian::debian' do
:repos => 'main'
)}
it { should contain_package('gplhost-archive-keyring') }
it { should contain_exec('installing gplhost-archive-keyring') }
end
describe 'with overridden release' do
@ -66,7 +66,7 @@ describe 'openstack_extras::repo::debian::debian' do
:repos => 'main'
)}
it { should contain_package('gplhost-archive-keyring') }
it { should contain_exec('installing gplhost-archive-keyring') }
end
describe 'when not managing wheezy repo' do
@ -74,7 +74,7 @@ describe 'openstack_extras::repo::debian::debian' do
default_params.merge!({ :manage_whz => false })
end
it { should_not contain_package('gplhost-archive-keyring') }
it { should_not contain_exec('installing gplhost-archive-keyring') }
end
describe 'with overridden source hash' do
@ -110,7 +110,7 @@ describe 'openstack_extras::repo::debian::debian' do
:key_server => 'pgp.mit.edu'
)}
it { should contain_package('gplhost-archive-keyring') }
it { should contain_exec('installing gplhost-archive-keyring') }
end
describe 'with overridden source default' do
@ -135,7 +135,7 @@ describe 'openstack_extras::repo::debian::debian' do
:include_src => 'true'
)}
it { should contain_package('gplhost-archive-keyring') }
it { should contain_exec('installing gplhost-archive-keyring') }
end
end
end

View File

@ -41,7 +41,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
:repos => 'main',
)}
it { should contain_package('ubuntu-cloud-keyring') }
it { should contain_exec('installing ubuntu-cloud-keyring') }
end
@ -56,7 +56,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
:repos => 'main',
)}
it { should contain_package('ubuntu-cloud-keyring') }
it { should contain_exec('installing ubuntu-cloud-keyring') }
end
describe 'when not managing UCA' do
@ -64,7 +64,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
default_params.merge!({ :manage_uca => false })
end
it { should_not contain_package('ubuntu-cloud-keyring') }
it { should_not contain_exec('installing ubuntu-cloud-keyring') }
end
describe 'with overridden source hash' do
@ -100,7 +100,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
:key_server => 'pgp.mit.edu'
)}
it { should contain_package('ubuntu-cloud-keyring') }
it { should contain_exec('installing ubuntu-cloud-keyring') }
end
describe 'with overridden source default' do
@ -118,7 +118,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
:repos => 'main',
)}
it { should contain_package('ubuntu-cloud-keyring') }
it { should contain_exec('installing ubuntu-cloud-keyring') }
end
end
end