From b44e05bc11db60aacd4595e827637eba4d10f415 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 31 Oct 2017 10:05:38 -0700 Subject: [PATCH] Ensure ara is updated on executors Depends-On: Id4f6ae8cc4128083f0db72fb6e2dc81b9968e884 Change-Id: I0feb48b8b12d2346c328ab9c16aaa45dd36ae0bf --- manifests/executor.pp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/manifests/executor.pp b/manifests/executor.pp index 6ceafea..529809a 100644 --- a/manifests/executor.pp +++ b/manifests/executor.pp @@ -35,10 +35,19 @@ class zuul::executor ( include ::pip::python3 - package { 'ara': - ensure => present, - provider => 'pip3', - require => Class['pip'], + exec { 'install-ara-safely': + command => 'pip3 install --upgrade --upgrade-strategy=only-if-needed ara', + path => '/usr/local/bin:/usr/bin:/bin/', + # This checks the current installed ara version with pip list and the + # latest version of ara 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 + # that ara's deps don't inadverdently update zuuls deps (specifically + # ansible). + onlyif => '/bin/bash -c "test \\"$(pip3 list --format columns | sed -ne \'s/^ara\s\+\(.*\)$/\1/p\')\\" != \\"$(pip3 search \'ara$\' | sed -ne \'s/^ara (\(.*\)).*$/\1/p\')\\""', + require => Class['::pip::python3'], } if ($::operatingsystem == 'Ubuntu') and ($::operatingsystemrelease >= '16.04') {