From aeadb730105e8a5ea1002c07c22af55707f2bd46 Mon Sep 17 00:00:00 2001 From: James Polley Date: Fri, 26 Dec 2014 10:38:54 +0100 Subject: [PATCH] Always use sudo -H when pip installing Recent versions of pip will create ~/.cache if it doesn't already exist. If this happens while running "sudo pip" the resulting dir will be owned by root and 700 - which breaks anything else on the system that wants to use ~/.cache I *think* this finds all instances of "sudo pip" in this repo and fixes them to use -H. This should mean they always run in the right ~ Change-Id: I47ddb3b591df6ac2100f09b38c9b8a03cb1ba1ff closes-bug: #1405732 --- jenkins/jobs/macros.yaml | 4 ++-- jenkins/jobs/sqlalchemy-migrate.yaml | 2 +- nodepool/elements/README.rst | 2 +- nodepool/elements/nodepool-base/install.d/99-install-zuul | 2 +- nodepool/scripts/fix_pip.sh | 2 +- nodepool/scripts/prepare_node.sh | 2 +- nodepool/scripts/prepare_tripleo.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jenkins/jobs/macros.yaml b/jenkins/jobs/macros.yaml index a0a794436c..bd1dfcfa70 100644 --- a/jenkins/jobs/macros.yaml +++ b/jenkins/jobs/macros.yaml @@ -142,7 +142,7 @@ builders: - shell: | #!/bin/bash -xe - sudo pip install ansible==1.6.10 + sudo -H pip install ansible==1.6.10 - builder: name: ansible-syntax-prep @@ -173,7 +173,7 @@ builders: - shell: | #!/bin/bash -xe - sudo pip install ansible-lint + sudo -H pip install ansible-lint - builder: name: ansible-lint diff --git a/jenkins/jobs/sqlalchemy-migrate.yaml b/jenkins/jobs/sqlalchemy-migrate.yaml index a31357ac2a..a6d4c5bfc2 100644 --- a/jenkins/jobs/sqlalchemy-migrate.yaml +++ b/jenkins/jobs/sqlalchemy-migrate.yaml @@ -25,7 +25,7 @@ function pre_test_hook {{ cd /opt/stack/new/sqlalchemy-migrate - sudo pip install . + sudo -H pip install . }} export -f pre_test_hook diff --git a/nodepool/elements/README.rst b/nodepool/elements/README.rst index 72b809a7c2..abebf7d9da 100644 --- a/nodepool/elements/README.rst +++ b/nodepool/elements/README.rst @@ -18,7 +18,7 @@ Install diskimage-builder: :: - sudo pip install diskimage-builder + sudo -H pip install diskimage-builder Build an image diff --git a/nodepool/elements/nodepool-base/install.d/99-install-zuul b/nodepool/elements/nodepool-base/install.d/99-install-zuul index 5b94945fbf..f372fa7d1a 100755 --- a/nodepool/elements/nodepool-base/install.d/99-install-zuul +++ b/nodepool/elements/nodepool-base/install.d/99-install-zuul @@ -18,5 +18,5 @@ git clone /opt/git/openstack-infra/zuul /tmp/zuul sudo virtualenv /usr/zuul-env -sudo /usr/zuul-env/bin/pip install /tmp/zuul +sudo -H /usr/zuul-env/bin/pip install /tmp/zuul sudo rm -fr /tmp/zuul diff --git a/nodepool/scripts/fix_pip.sh b/nodepool/scripts/fix_pip.sh index 8c171355bd..e3f799d1cc 100755 --- a/nodepool/scripts/fix_pip.sh +++ b/nodepool/scripts/fix_pip.sh @@ -27,4 +27,4 @@ PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py if [ ! -f get-pip.py ] ; then curl -O $PIP_GET_PIP_URL || wget $PIP_GET_PIP_URL fi -sudo python get-pip.py +sudo -H python get-pip.py diff --git a/nodepool/scripts/prepare_node.sh b/nodepool/scripts/prepare_node.sh index cdbe07c984..7fceae2765 100755 --- a/nodepool/scripts/prepare_node.sh +++ b/nodepool/scripts/prepare_node.sh @@ -154,7 +154,7 @@ sudo rm -f /etc/cron.{monthly,weekly,daily,hourly,d}/* # to using 3.3 with virtualenv. git clone /opt/git/openstack-infra/zuul /tmp/zuul sudo virtualenv -p python2 /usr/zuul-env -sudo /usr/zuul-env/bin/pip install /tmp/zuul +sudo -H /usr/zuul-env/bin/pip install /tmp/zuul sudo rm -fr /tmp/zuul sync diff --git a/nodepool/scripts/prepare_tripleo.sh b/nodepool/scripts/prepare_tripleo.sh index 97d1fa4e64..1db9ffdc67 100755 --- a/nodepool/scripts/prepare_tripleo.sh +++ b/nodepool/scripts/prepare_tripleo.sh @@ -28,7 +28,7 @@ cd /opt/nodepool-scripts/ ./install_devstack_dependencies.sh # toci scripts use both of these -sudo pip install gear os-apply-config +sudo -H pip install gear os-apply-config # tripleo-gate runs with two networks - the public access network and eth1 # pointing at the in-datacentre L2 network where we can talk to the test