From 313ddaee6102fc03a3885bec3bf5e0d1e0214878 Mon Sep 17 00:00:00 2001 From: Lenny Verkhovsky Date: Tue, 20 Oct 2015 11:26:34 +0300 Subject: [PATCH] Remove sudo from mkdir in $STACK_USER folder This fails in the environment where sudo does not have permissions to write in /home/$USER folder, e.g. [1] Also clean-up the comment/variable usage a bit; the location isn't actually variable at all (and that's fine, but we don't need a global here) [1] http://144.76.193.39/ci-artifacts/228979/10/Nova-ML2-Sriov/console.html.gz Change-Id: I6807eae9d1c27219aa7c19de29f24fa851aa787c --- functions-common | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/functions-common b/functions-common index 42555a95f5..6607d0be70 100644 --- a/functions-common +++ b/functions-common @@ -73,21 +73,23 @@ function save_stackenv { # - A `devstack-admin` entry for the `admin` user for the `admin` project. # write_clouds_yaml function write_clouds_yaml { - # The location is a variable to allow for easier refactoring later to make it - # overridable. There is currently no usecase where doing so makes sense, so - # it's not currently configurable. - for clouds_path in /etc/openstack ~/.config/openstack ; do - CLOUDS_YAML=$clouds_path/clouds.yaml + local clouds_yaml - sudo mkdir -p $(dirname $CLOUDS_YAML) - sudo chown -R $STACK_USER $(dirname $CLOUDS_YAML) + sudo mkdir -p /etc/openstack + sudo chown -R $STACK_USER /etc/openstack + # XXX: to be removed, see https://review.openstack.org/237149/ + # careful not to sudo this, incase ~ is NFS mounted + mkdir -p ~/.config/openstack + + for clouds_path in /etc/openstack ~/.config/openstack ; do + clouds_yaml=$clouds_path/clouds.yaml CA_CERT_ARG='' if [ -f "$SSL_BUNDLE_FILE" ]; then CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE" fi $TOP_DIR/tools/update_clouds_yaml.py \ - --file $CLOUDS_YAML \ + --file $clouds_yaml \ --os-cloud devstack \ --os-region-name $REGION_NAME \ --os-identity-api-version 3 \ @@ -97,7 +99,7 @@ function write_clouds_yaml { --os-password $ADMIN_PASSWORD \ --os-project-name demo $TOP_DIR/tools/update_clouds_yaml.py \ - --file $CLOUDS_YAML \ + --file $clouds_yaml \ --os-cloud devstack-admin \ --os-region-name $REGION_NAME \ --os-identity-api-version 3 \