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
... | ... |
@@ -73,21 +73,23 @@ function save_stackenv { |
73 | 73 |
# - A `devstack-admin` entry for the `admin` user for the `admin` project. |
74 | 74 |
# write_clouds_yaml |
75 | 75 |
function write_clouds_yaml { |
76 |
- # The location is a variable to allow for easier refactoring later to make it |
|
77 |
- # overridable. There is currently no usecase where doing so makes sense, so |
|
78 |
- # it's not currently configurable. |
|
79 |
- for clouds_path in /etc/openstack ~/.config/openstack ; do |
|
80 |
- CLOUDS_YAML=$clouds_path/clouds.yaml |
|
76 |
+ local clouds_yaml |
|
77 |
+ |
|
78 |
+ sudo mkdir -p /etc/openstack |
|
79 |
+ sudo chown -R $STACK_USER /etc/openstack |
|
80 |
+ # XXX: to be removed, see https://review.openstack.org/237149/ |
|
81 |
+ # careful not to sudo this, incase ~ is NFS mounted |
|
82 |
+ mkdir -p ~/.config/openstack |
|
81 | 83 |
|
82 |
- sudo mkdir -p $(dirname $CLOUDS_YAML) |
|
83 |
- sudo chown -R $STACK_USER $(dirname $CLOUDS_YAML) |
|
84 |
+ for clouds_path in /etc/openstack ~/.config/openstack ; do |
|
85 |
+ clouds_yaml=$clouds_path/clouds.yaml |
|
84 | 86 |
|
85 | 87 |
CA_CERT_ARG='' |
86 | 88 |
if [ -f "$SSL_BUNDLE_FILE" ]; then |
87 | 89 |
CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE" |
88 | 90 |
fi |
89 | 91 |
$TOP_DIR/tools/update_clouds_yaml.py \ |
90 |
- --file $CLOUDS_YAML \ |
|
92 |
+ --file $clouds_yaml \ |
|
91 | 93 |
--os-cloud devstack \ |
92 | 94 |
--os-region-name $REGION_NAME \ |
93 | 95 |
--os-identity-api-version 3 \ |
... | ... |
@@ -97,7 +99,7 @@ function write_clouds_yaml { |
97 | 97 |
--os-password $ADMIN_PASSWORD \ |
98 | 98 |
--os-project-name demo |
99 | 99 |
$TOP_DIR/tools/update_clouds_yaml.py \ |
100 |
- --file $CLOUDS_YAML \ |
|
100 |
+ --file $clouds_yaml \ |
|
101 | 101 |
--os-cloud devstack-admin \ |
102 | 102 |
--os-region-name $REGION_NAME \ |
103 | 103 |
--os-identity-api-version 3 \ |