Fix subunit2sql install guard for idempotency

The exec to install subunit2sql tries to compare the output of pip list
versus pip search to determine whether it is on the latest version.
Without this patch, the pip list command produces a string that has too
many spaces on the end and therefore doesn't match the result of the pip
search command. This means that it will always try to reinstall
subunit2sql even when it doesn't need to, which breaks idempotency
tests. This patch fixes the regex group to exclude trailing spaces.

Change-Id: I92f614db2da936d68d8f2305b348c65ba773b01c
This commit is contained in:
Colleen Murphy 2018-07-10 13:51:34 +02:00
parent 2d4e2178fe
commit 8360c894db
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ class subunit2sql (
# 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 \\"$(pip list --format columns | sed -ne \'s/^subunit2sql\s\+\(.*\)$/\1/p\')\\" != \\"$(pip search \'subunit2sql$\' | sed -ne \'s/^subunit2sql (\(.*\)).*$/\1/p\')\\""',
onlyif => '/bin/bash -c "test \\"$(pip list --format columns | sed -ne \'s/^subunit2sql\s\+\([[:digit:].]*\)\s*$/\1/p\')\\" != \\"$(pip search \'subunit2sql$\' | sed -ne \'s/^subunit2sql (\(.*\)).*$/\1/p\')\\""',
require => [
Class['pip'],
Package['python-mysqldb'],