Browse code

Write out a clouds.yaml file

os-client-config consumes clouds.yaml files, which is now supported in
python-openstackclient and shade. It also makes for a non-envvar way of
getting config info into functional tests.

Change-Id: I1150b943f52f10d19f8434b27e8dde73a14d7843

Monty Taylor authored on 2015/05/15 00:20:39
Showing 2 changed files
... ...
@@ -130,7 +130,7 @@ if [[ -n "$SCREEN_LOGDIR" ]] && [[ -d "$SCREEN_LOGDIR" ]]; then
130 130
 fi
131 131
 
132 132
 # Clean up venvs
133
-DIRS_TO_CLEAN="$WHEELHOUSE ${PROJECT_VENV[@]}"
133
+DIRS_TO_CLEAN="$WHEELHOUSE ${PROJECT_VENV[@]} .config/openstack"
134 134
 rm -rf $DIRS_TO_CLEAN
135 135
 
136 136
 # Clean up files
... ...
@@ -1294,6 +1294,29 @@ for i in BASE_SQL_CONN ENABLED_SERVICES HOST_IP LOGFILE \
1294 1294
     echo $i=${!i} >>$TOP_DIR/.stackenv
1295 1295
 done
1296 1296
 
1297
+# Write out a clouds.yaml file
1298
+# putting the location into a variable to allow for easier refactoring later
1299
+# to make it overridable. There is current no usecase where doing so makes
1300
+# sense, so I'm not actually doing it now.
1301
+CLOUDS_YAML=~/.config/openstack/clouds.yaml
1302
+if [ ! -e $CLOUDS_YAML ]; then
1303
+    mkdir -p $(dirname $CLOUDS_YAML)
1304
+    cat >"$CLOUDS_YAML" <<EOF
1305
+clouds:
1306
+  devstack:
1307
+    auth:
1308
+      auth_url: $KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION
1309
+      username: demo
1310
+      project_name: demo
1311
+      password: $ADMIN_PASSWORD
1312
+    region_name: $REGION_NAME
1313
+    identity_api_version: $IDENTITY_API_VERSION
1314
+EOF
1315
+    if [ -f "$SSL_BUNDLE_FILE" ]; then
1316
+        echo "    cacert: $SSL_BUNDLE_FILE" >>"$CLOUDS_YAML"
1317
+    fi
1318
+fi
1319
+
1297 1320
 
1298 1321
 # Wrapup configuration
1299 1322
 # ====================