From e02cfe94a364b9aa880d026c8e9089fe4ffb2829 Mon Sep 17 00:00:00 2001
From: Jeremy Stanley <fungi@yuggoth.org>
Date: Tue, 12 Dec 2017 00:58:20 +0000
Subject: [PATCH] Don't hardcode the path to pip

In at least some circumstances, our pip is installed into
/usr/local/bin to make sure that's added to the environment and
switch to dynamic path resolution when calling pip.

Change-Id: I4e53ce2aba1b8335025e180bd03a5f5e93461814
---
 manifests/init.pp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/manifests/init.pp b/manifests/init.pp
index 50e45f5..fdf2666 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -38,7 +38,8 @@ class subunit2sql (
   }
 
   exec { 'install-subunit2sql-safely':
-    command => '/usr/bin/pip install --upgrade --upgrade-strategy=only-if-needed subunit2sql',
+    command => 'pip install --upgrade --upgrade-strategy=only-if-needed subunit2sql',
+    path    => '/usr/local/bin:/usr/bin:/bin/',
     # 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
@@ -49,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 $(/usr/bin/pip list --format columns | sed -ne \'s/^subunit2sql\s\+\(.*\)$/\1/p\') != $(/usr/bin/pip search \'subunit2sql$\' | sed -ne \'s/^subunit2sql (\(.*\)).*$/\1/p\')"',
+    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\')"',
     require => [
       Class['pip'],
       Package['python-mysqldb'],