Rework the package upgrade after repos

This moves back the generic upgrade process
for packages after the repos are added back
to the run_tests.sh script.

Instead if solves the known python-chardet
dependency bug for requests package for RPM
packaging in the repos.pp manifest.

This is because we need to fix that bug when
running the beaker tests.

We need to keep an eye out if we see any
similar bugs in the future now that updates
are now executed for all packages in beaker
tests.

Change-Id: If12897355d5a4ba7c05e6ee79d63417fcae03977
This commit is contained in:
Tobias Urdin 2018-09-08 22:10:53 +02:00
parent ddc4986c60
commit 8dc7b22c35
2 changed files with 23 additions and 28 deletions

View File

@ -15,7 +15,6 @@ class openstack_integration::repos {
release => 'rocky',
package_require => true,
uca_location => pick($::uca_mirror_host, 'http://ubuntu-cloud.archive.canonical.com/ubuntu'),
before => File['/tmp/update-packages'],
}
}
'debian': {
@ -23,7 +22,6 @@ class openstack_integration::repos {
class { '::openstack_extras::repo::debian::debian':
release => 'queens',
package_require => true,
before => File['/tmp/update-packages'],
}
}
default: {
@ -37,13 +35,11 @@ class openstack_integration::repos {
apt::pin { 'ceph':
priority => 1001,
originator => "Ceph ${ceph_version_cap}",
before => File['/tmp/update-packages'],
}
} else {
apt::pin { 'ceph':
priority => 1001,
origin => 'download.ceph.com',
before => File['/tmp/update-packages'],
}
}
$enable_sig = false
@ -68,7 +64,6 @@ class openstack_integration::repos {
'gpgcheck' => 'no',
},
},
before => File['/tmp/update-packages'],
}
# TODO(tobasco): Remove this CBS candidate repo for Mimic when Storage SIG release it.
$ceph_mirror_fallback = $ceph_version_real ? {
@ -94,7 +89,6 @@ class openstack_integration::repos {
matches => [ 'fedora*.repo' ],
rmdirs => false,
require => Class['::openstack_extras::repo::redhat::redhat'],
before => File['/tmp/update-packages'],
}
}
}
@ -107,32 +101,21 @@ class openstack_integration::repos {
enable_sig => $enable_sig,
enable_epel => $enable_epel,
ceph_mirror => $ceph_mirror,
before => File['/tmp/update-packages'],
}
# We want to upgrade packages after repos is added but only once
# to not break idempotency. Must be done in here so it applies to
# both integration and beaker tests.
# NOTE(tobias-urdin): The python-requests RPM package has a package dependency
# which upstream requests package does not support so it outputs a warning which
# messes up output (warning is printed to stdout) an causes some providers that
# rely on the stdout output to fail. If you upgrade the python-chardet dependency
# to a newer version you are fine, is reported upstream:
# https://bugzilla.redhat.com/show_bug.cgi?id=1620221
# This is added here so we have the latest of this package in both integration and
# beaker testing.
if $::osfamily == 'RedHat' {
if $::operatingsystem == 'Fedora' {
$yum_cmd = '/usr/bin/dnf'
} else {
$yum_cmd = '/usr/bin/yum'
package { 'python-chardet':
ensure => 'latest',
}
$update_cmd = "${yum_cmd} update -y"
} else {
$update_cmd = '/usr/bin/apt upgrade -y'
}
file { '/tmp/update-packages':
ensure => 'present',
notify => Exec['update-packages'],
}
exec { 'update-packages':
command => $update_cmd,
refreshonly => true,
tries => 2,
timeout => 900,
Yumrepo<||> -> Package<| title == 'python-chardet' |>
}
}

View File

@ -204,6 +204,18 @@ if [ "${MANAGE_REPOS}" = true ]; then
print_header 'Puppet failed to install repositories.'
exit 1
fi
print_header 'Updating packages'
if is_fedora; then
$SUDO $YUM update -y
update_ret=$?
elif uses_debs; then
$SUDO apt-get upgrade -y
update_ret=$?
fi
if [ $update_ret -ne 0 ]; then
print_header 'Error updating packages'
exit 1
fi
fi
print_header "Running Puppet Scenario: ${SCENARIO} (1st time)"