Fix copying of select-mirror outputs.

The Jenkins user was attempting to write to ~stack and failing because
it does not have permission to do so. Use more sudo to get around that.
Additionally move the fix for /etc/hosts into setup_host instead of
setup_workspace. This will make the use of sudo quieter as it will be
able to resolve $HOSTNAME earlier.

Change-Id: I8e6bd821ceac9d0614c068dc7ce7a6657329d84c
This commit is contained in:
Clark Boylan
2013-12-23 21:07:59 -08:00
parent 8fb1a5f93e
commit daded8d4d6

View File

@@ -172,8 +172,6 @@ function setup_workspace {
# Enabled detailed logging, since output of this function is redirected
set -o xtrace
fix_etc_hosts
fix_disk_layout
sudo mkdir -p $DEST
@@ -211,17 +209,19 @@ function select_mirror {
SHORT_PROJECT=$(basename $ZUUL_PROJECT)
$DEVSTACK_GATE_SELECT_MIRROR $ORG $SHORT_PROJECT
cp ~/.pydistutils.cfg ~stack/.pydistutils.cfg
sudo cp ~/.pydistutils.cfg ~root/.pydistutils.cfg
sudo cp ~/.pydistutils.cfg ~stack/.pydistutils.cfg
sudo chown stack:stack ~stack/.pydistutils.cfg
sudo cp ~/.pydistutils.cfg ~tempest/.pydistutils.cfg
sudo chown tempest:tempest ~tempest/.pydistutils.cfg
mkdir -p ~stack/.pip
sudo -u stack mkdir -p ~stack/.pip
sudo -u root mkdir -p ~root/.pip
sudo -u tempest mkdir -p ~tempest/.pip
cp ~/.pip/pip.conf ~stack/.pip/pip.conf
sudo -u root cp ~/.pip/pip.conf ~root/.pip/pip.conf
sudo cp ~/.pip/pip.conf ~stack/.pip/pip.conf
sudo chown stack:stack ~stack/.pip/pip.conf
sudo cp ~/.pip/pip.conf ~tempest/.pip/pip.conf
sudo chown tempest:tempest ~tempest/.pip/pip.conf
fi
@@ -231,6 +231,9 @@ function setup_host {
# Enabled detailed logging, since output of this function is redirected
set -o xtrace
# This is necessary to keep sudo from complaining
fix_etc_hosts
# Move the PIP cache into position:
sudo mkdir -p /var/cache/pip
sudo mv ~/cache/pip/* /var/cache/pip