Fix stretch queens repo

This patch fixes the URLs for the stretch-queens Debian repo.
First, it uses the now standardized scheme for the backport
URL: http://<debian-release>-<openstack-release>.debian.net/debian,
maintained by the Debian OpenStack team.

Then it uses $::lsbdistcodename everywhere, to be able to work
with all Debian releases.

Finally, this patch fixes unit tests to work with stretch and queens
as default.

Change-Id: I96af5021c51d6db9946197f8bc187a386ae04f25
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Thomas Goirand 2018-04-03 13:35:05 +02:00 committed by Alex Schultz
parent 1c7626d11e
commit 9b63dc312e
4 changed files with 71 additions and 48 deletions

View File

@ -7,12 +7,12 @@
#
# [*release*]
# (optional) The OpenStack release to add a
# Debian Wheezy apt source for.
# Defaults to 'kilo'
# Debian Stretch apt source for.
# Defaults to 'queens'
#
# [*manage_whz*]
# [*manage_deb*]
# (optional) Whether or not to add the default
# Debian Wheezy APT source
# Debian Stretch APT source
# Defaults to true
#
# [*source_hash*]
@ -30,32 +30,48 @@
# installing any packages.
# Defaults to false
#
# [*deb_location*]
# (optional) Debian package repository location.
# Defaults to $::openstack_extras::repo::debian::params::deb_location
#
# === DEPRECATED
#
# [*manage_whz*]
# (optional) Whether or not to add the default Debian Stretch APT source
# Replaced by $manage_deb instead.
# Defaults to true
#
class openstack_extras::repo::debian::debian(
$release = $::openstack_extras::repo::debian::params::release,
$manage_whz = true,
$manage_deb = true,
$source_hash = {},
$source_defaults = {},
$package_require = false
$package_require = false,
$deb_location = "http://${::lsbdistcodename}-${release}.debian.net/debian",
# DEPRECATED
$manage_whz = undef,
) inherits openstack_extras::repo::debian::params {
if $manage_whz {
exec { 'installing gplhost-archive-keyring':
command => '/usr/bin/apt-get -y install gplhost-archive-keyring',
# handle deprecation
$deb_manage = pick($manage_whz, $manage_deb)
if $deb_manage {
exec { 'installing openstack-backports-archive-keyring':
command => "/usr/bin/apt-get -y ${::openstack_extras::repo::debian::params::deb_required_packages}",
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"],
subscribe => File["/etc/apt/sources.list.d/${::openstack_extras::repo::debian::params::deb_name}.list"],
notify => Exec['apt_update'],
}
apt::source { $::openstack_extras::repo::debian::params::whz_name:
location => $::openstack_extras::repo::debian::params::whz_location,
release => $release,
repos => $::openstack_extras::repo::debian::params::whz_repos,
apt::source { $::openstack_extras::repo::debian::params::deb_name:
location => $deb_location,
release => "${::lsbdistcodename}-${release}-backports",
repos => $::openstack_extras::repo::debian::params::deb_repos,
}
-> apt::source { "${::openstack_extras::repo::debian::params::whz_name}_backports":
location => $::openstack_extras::repo::debian::params::whz_location,
release => "${release}-backports",
repos => $::openstack_extras::repo::debian::params::whz_repos,
-> apt::source { "${::openstack_extras::repo::debian::params::deb_name}-nochange":
location => $deb_location,
release => "${::lsbdistcodename}-${release}-backports-nochange",
repos => $::openstack_extras::repo::debian::params::deb_repos,
}
}

View File

@ -4,15 +4,15 @@
#
class openstack_extras::repo::debian::params
{
$release = 'pike'
$release = 'queens'
$uca_name = 'ubuntu-cloud-archive'
$uca_location = 'http://ubuntu-cloud.archive.canonical.com/ubuntu'
$uca_repos = 'main'
$uca_required_packages = 'ubuntu-cloud-keyring'
$whz_name = 'debian_wheezy'
$whz_location = 'http://archive.gplhost.com/debian'
$whz_repos = 'main'
$whz_required_packages = 'gplhost-archive-keyring'
$deb_name = 'debian-openstack-backports'
$deb_location = "http://${::lsbdistcodename}-${release}.debian.net/debian"
$deb_repos = 'main'
$deb_required_packages = 'openstack-backports-archive-keyring'
}

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
```openstack_extras::repo::debian::debian::manage_whz``` has been drepcated.
Use ```openstack_extras::repo::debian::debian::manage_deb``` instead.

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'openstack_extras::repo::debian::debian' do
let :class_params do
{
:manage_whz => true,
:manage_deb => true,
:source_hash => {},
:source_defaults => {},
:package_require => false
@ -12,7 +12,7 @@ describe 'openstack_extras::repo::debian::debian' do
let :paramclass_defaults do
{
:release => 'pike'
:release => 'queens'
}
end
@ -26,7 +26,8 @@ describe 'openstack_extras::repo::debian::debian' do
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:lsbdistid => 'Debian',
:lsbdistrelease => '8'
:lsbdistcodename => 'stretch',
:lsbdistrelease => '9'
})
end
@ -35,47 +36,47 @@ describe 'openstack_extras::repo::debian::debian' do
{}.merge!(default_params)
end
it { is_expected.to contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'pike',
it { is_expected.to contain_apt__source('debian-openstack-backports').with(
:location => 'http://stretch-queens.debian.net/debian',
:release => 'stretch-queens-backports',
:repos => 'main',
)}
it { is_expected.to contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'pike-backports',
it { is_expected.to contain_apt__source('debian-openstack-backports-nochange').with(
:location => 'http://stretch-queens.debian.net/debian',
:release => 'stretch-queens-backports-nochange',
:repos => 'main'
)}
it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
it { is_expected.to contain_exec('installing openstack-backports-archive-keyring') }
end
describe 'with overridden release' do
let :params do
default_params.merge!({ :release => 'juno' })
default_params.merge!({ :release => 'pike' })
end
it { is_expected.to contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'juno',
it { is_expected.to contain_apt__source('debian-openstack-backports').with(
:location => 'http://stretch-pike.debian.net/debian',
:release => 'stretch-pike-backports',
:repos => 'main',
)}
it { is_expected.to contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'juno-backports',
it { is_expected.to contain_apt__source('debian-openstack-backports-nochange').with(
:location => 'http://stretch-pike.debian.net/debian',
:release => 'stretch-pike-backports-nochange',
:repos => 'main'
)}
it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
it { is_expected.to contain_exec('installing openstack-backports-archive-keyring') }
end
describe 'when not managing wheezy repo' do
describe 'when not managing stretch repo' do
let :params do
default_params.merge!({ :manage_whz => false })
default_params.merge!({ :manage_deb => false })
end
it { is_expected.to_not contain_exec('installing gplhost-archive-keyring') }
it { is_expected.to_not contain_exec('installing openstack-backports-archive-keyring') }
end
describe 'with overridden source hash' do
@ -89,7 +90,7 @@ describe 'openstack_extras::repo::debian::debian' do
'puppetlabs' => {
'location' => 'http://apt.puppetlabs.com',
'repos' => 'main',
'release' => 'wheezy',
'release' => 'stretch',
'key' => '4BD6EC30',
'key_server' => 'pgp.mit.edu'
}
@ -106,12 +107,12 @@ describe 'openstack_extras::repo::debian::debian' do
it { is_expected.to contain_apt__source('puppetlabs').with(
:location => 'http://apt.puppetlabs.com',
:repos => 'main',
:release => 'wheezy',
:release => 'stretch',
:key => '4BD6EC30',
:key_server => 'pgp.mit.edu'
)}
it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
it { is_expected.to contain_exec('installing openstack-backports-archive-keyring') }
end
describe 'with overridden source default' do
@ -137,7 +138,7 @@ describe 'openstack_extras::repo::debian::debian' do
:include_src => 'true'
)}
it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
it { is_expected.to contain_exec('installing openstack-backports-archive-keyring') }
end
end
end