Install/upgrade subunit2sql safely
When installing or upgrading subunit2sql, override pip's default upgrade strategy to avoid updating preinstalled dependencies if they already satisfy the requirements. This in particular avoids attempting to replace the distro package of python-netifaces by rebuilding a newer sdist (it is not distributed as a wheel on PyPI and needs C extensions compiled, which in turn have a lot of build-time deps). This implementation is copied from the puppet-zuul module. Change-Id: I885a61527ca9938200fb965ea97ff957fed3c480
This commit is contained in:
parent
69150752a0
commit
9e2a5d4633
|
@ -37,10 +37,20 @@ class subunit2sql (
|
|||
require => Class['pip'],
|
||||
}
|
||||
|
||||
package { 'subunit2sql':
|
||||
ensure => latest,
|
||||
provider => openstack_pip,
|
||||
require => [
|
||||
exec { 'install-subunit2sql-safely':
|
||||
command => '/usr/bin/pip install --upgrade --upgrade-strategy=only-if-needed subunit2sql',
|
||||
# This checks the current installed subunit2sql version with pip list and
|
||||
# the latest version of subunit2sql on pypi with pip search and if they are
|
||||
# different then we know we need to upgrade to reconcile the local version
|
||||
# with the upstream version.
|
||||
#
|
||||
# We do this using this check here rather than a pip package resource so we
|
||||
# can override pip's default upgrade strategy in order to avoid replacing
|
||||
# deps we've preinstalled from system packages because they lack wheels on
|
||||
# PyPI and must be otherwise rebuilt from sdist instead (specifically
|
||||
# netifaces).
|
||||
onlyif => '/bin/bash -c "test $(/usr/bin/pip list --format columns | sed -ne \'s/^subunit2sql\s\+\(.*\)$/\1/p\') != $(/usr/bin/pip search \'subunit2sql$\' | sed -ne \'s/^subunit2sql (\(.*\)).*$/\1/p\')"',
|
||||
require => [
|
||||
Class['pip'],
|
||||
Package['python-mysqldb'],
|
||||
Package['python-psycopg2'],
|
||||
|
@ -107,7 +117,7 @@ class subunit2sql (
|
|||
Package['python-zmq'],
|
||||
Package['python-yaml'],
|
||||
Package['gear'],
|
||||
Package['subunit2sql'],
|
||||
Exec['install-subunit2sql-safely'],
|
||||
Package['python-subunit'],
|
||||
Package['testtools']
|
||||
],
|
||||
|
|
|
@ -56,7 +56,7 @@ class subunit2sql::server (
|
|||
exec { 'upgrade_subunit2sql_db':
|
||||
command => '/usr/local/bin/run_migrations.sh',
|
||||
require => File['/usr/local/bin/run_migrations.sh'],
|
||||
subscribe => Package['subunit2sql'],
|
||||
subscribe => Exec['install-subunit2sql-safely'],
|
||||
refreshonly => true,
|
||||
timeout => 0,
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ if ! defined(File['/var/log/subunit2sql']) {
|
|||
hasrestart => true,
|
||||
subscribe => [
|
||||
File["/etc/subunit2sql/jenkins-subunit-worker${suffix}.yaml"],
|
||||
Package['subunit2sql'],
|
||||
Exec['install-subunit2sql-safely'],
|
||||
],
|
||||
require => [
|
||||
File['/etc/subunit2sql'],
|
||||
|
|
Loading…
Reference in New Issue