Browse code

Write clouds.yaml to only /etc

After having migrated the copies of clouds.yaml to just consume from
/etc, remove the duplicate copy.

Change-Id: I036704734785958c95d2234917d7b40bd797a375

Monty Taylor authored on 2015/10/20 04:16:18
Showing 1 changed files
... ...
@@ -73,42 +73,39 @@ 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
-    local 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.
77 79
 
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
80
+    CLOUDS_YAML=/etc/openstack/clouds.yaml
83 81
 
84
-    for clouds_path in /etc/openstack ~/.config/openstack ; do
85
-        clouds_yaml=$clouds_path/clouds.yaml
82
+    sudo mkdir -p $(dirname $CLOUDS_YAML)
83
+    sudo chown -R $STACK_USER /etc/openstack
86 84
 
87
-        CA_CERT_ARG=''
88
-        if [ -f "$SSL_BUNDLE_FILE" ]; then
89
-            CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE"
90
-        fi
91
-        $TOP_DIR/tools/update_clouds_yaml.py \
92
-            --file $clouds_yaml \
93
-            --os-cloud devstack \
94
-            --os-region-name $REGION_NAME \
95
-            --os-identity-api-version 3 \
96
-            $CA_CERT_ARG \
97
-            --os-auth-url $KEYSTONE_AUTH_URI \
98
-            --os-username demo \
99
-            --os-password $ADMIN_PASSWORD \
100
-            --os-project-name demo
101
-        $TOP_DIR/tools/update_clouds_yaml.py \
102
-            --file $clouds_yaml \
103
-            --os-cloud devstack-admin \
104
-            --os-region-name $REGION_NAME \
105
-            --os-identity-api-version 3 \
106
-            $CA_CERT_ARG \
107
-            --os-auth-url $KEYSTONE_AUTH_URI \
108
-            --os-username admin \
109
-            --os-password $ADMIN_PASSWORD \
110
-            --os-project-name admin
111
-    done
85
+    CA_CERT_ARG=''
86
+    if [ -f "$SSL_BUNDLE_FILE" ]; then
87
+        CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE"
88
+    fi
89
+    $TOP_DIR/tools/update_clouds_yaml.py \
90
+        --file $CLOUDS_YAML \
91
+        --os-cloud devstack \
92
+        --os-region-name $REGION_NAME \
93
+        --os-identity-api-version 3 \
94
+        $CA_CERT_ARG \
95
+        --os-auth-url $KEYSTONE_AUTH_URI \
96
+        --os-username demo \
97
+        --os-password $ADMIN_PASSWORD \
98
+        --os-project-name demo
99
+    $TOP_DIR/tools/update_clouds_yaml.py \
100
+        --file $CLOUDS_YAML \
101
+        --os-cloud devstack-admin \
102
+        --os-region-name $REGION_NAME \
103
+        --os-identity-api-version 3 \
104
+        $CA_CERT_ARG \
105
+        --os-auth-url $KEYSTONE_AUTH_URI \
106
+        --os-username admin \
107
+        --os-password $ADMIN_PASSWORD \
108
+        --os-project-name admin
112 109
 }
113 110
 
114 111
 # trueorfalse <True|False> <VAR>