Browse code

Merge "Allow heat standalone to work devstack stack"

Jenkins authored on 2014/10/02 11:40:18
Showing 3 changed files
... ...
@@ -40,6 +40,8 @@ HEAT_CONF=$HEAT_CONF_DIR/heat.conf
40 40
 HEAT_ENV_DIR=$HEAT_CONF_DIR/environment.d
41 41
 HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates
42 42
 HEAT_STACK_DOMAIN=`trueorfalse True $HEAT_STACK_DOMAIN`
43
+HEAT_API_HOST=${HEAT_API_HOST:-$HOST_IP}
44
+HEAT_API_PORT=${HEAT_API_PORT:-8004}
43 45
 
44 46
 # other default options
45 47
 HEAT_DEFERRED_AUTH=${HEAT_DEFERRED_AUTH:-trusts}
... ...
@@ -69,6 +71,9 @@ function cleanup_heat {
69 69
 # configure_heat() - Set config files, create data dirs, etc
70 70
 function configure_heat {
71 71
     setup_develop $HEAT_DIR
72
+    if [[ "$HEAT_STANDALONE" = "True" ]]; then
73
+        setup_develop $HEAT_DIR/contrib/heat_keystoneclient_v2
74
+    fi
72 75
 
73 76
     if [[ ! -d $HEAT_CONF_DIR ]]; then
74 77
         sudo mkdir -p $HEAT_CONF_DIR
... ...
@@ -83,8 +88,6 @@ function configure_heat {
83 83
     HEAT_ENGINE_PORT=${HEAT_ENGINE_PORT:-8001}
84 84
     HEAT_API_CW_HOST=${HEAT_API_CW_HOST:-$HOST_IP}
85 85
     HEAT_API_CW_PORT=${HEAT_API_CW_PORT:-8003}
86
-    HEAT_API_HOST=${HEAT_API_HOST:-$HOST_IP}
87
-    HEAT_API_PORT=${HEAT_API_PORT:-8004}
88 86
     HEAT_API_PASTE_FILE=$HEAT_CONF_DIR/api-paste.ini
89 87
     HEAT_POLICY_FILE=$HEAT_CONF_DIR/policy.json
90 88
 
... ...
@@ -120,7 +123,11 @@ function configure_heat {
120 120
     iniset $HEAT_CONF ec2authtoken auth_uri $KEYSTONE_SERVICE_URI/v2.0
121 121
 
122 122
     # paste_deploy
123
-    [[ "$HEAT_STANDALONE" = "True" ]] && iniset $HEAT_CONF paste_deploy flavor standalone
123
+    if [[ "$HEAT_STANDALONE" = "True" ]]; then
124
+        iniset $HEAT_CONF paste_deploy flavor standalone
125
+        iniset $HEAT_CONF DEFAULT keystone_backend heat_keystoneclient_v2.client.KeystoneClientV2
126
+        iniset $HEAT_CONF clients_heat url "http://$HEAT_API_HOST:$HEAT_API_PORT/v1/%(tenant_id)s"
127
+    fi
124 128
 
125 129
     # OpenStack API
126 130
     iniset $HEAT_CONF heat_api bind_port $HEAT_API_PORT
... ...
@@ -997,7 +997,7 @@ if is_service_enabled key; then
997 997
         create_swift_accounts
998 998
     fi
999 999
 
1000
-    if is_service_enabled heat; then
1000
+    if is_service_enabled heat && [[ "$HEAT_STANDALONE" != "True" ]]; then
1001 1001
         create_heat_accounts
1002 1002
     fi
1003 1003
 
... ...
@@ -1298,6 +1298,10 @@ if is_service_enabled nova && is_service_enabled key; then
1298 1298
         USERRC_PARAMS="$USERRC_PARAMS --os-cacert $SSL_BUNDLE_FILE"
1299 1299
     fi
1300 1300
 
1301
+    if [[ "$HEAT_STANDALONE" = "True" ]]; then
1302
+        USERRC_PARAMS="$USERRC_PARAMS --heat-url http://$HEAT_API_HOST:$HEAT_API_PORT/v1"
1303
+    fi
1304
+
1301 1305
     $TOP_DIR/tools/create_userrc.sh $USERRC_PARAMS
1302 1306
 fi
1303 1307
 
... ...
@@ -37,6 +37,7 @@ Optional Arguments
37 37
 -C <tenant_name> create user and tenant, the specifid tenant will be the user's tenant
38 38
 -r <name> when combined with -C and the (-u) user exists it will be the user's tenant role in the (-C)tenant (default: Member)
39 39
 -p <userpass> password for the user
40
+--heat-url <heat_url>
40 41
 --os-username <username>
41 42
 --os-password <admin password>
42 43
 --os-tenant-name <tenant_name>
... ...
@@ -53,12 +54,13 @@ $0 -P -C mytenant -u myuser -p mypass
53 53
 EOF
54 54
 }
55 55
 
56
-if ! options=$(getopt -o hPAp:u:r:C: -l os-username:,os-password:,os-tenant-name:,os-tenant-id:,os-auth-url:,target-dir:,skip-tenant:,os-cacert:,help,debug -- "$@"); then
56
+if ! options=$(getopt -o hPAp:u:r:C: -l os-username:,os-password:,os-tenant-name:,os-tenant-id:,os-auth-url:,target-dir:,heat-url:,skip-tenant:,os-cacert:,help,debug -- "$@"); then
57 57
     display_help
58 58
     exit 1
59 59
 fi
60 60
 eval set -- $options
61 61
 ADDPASS=""
62
+HEAT_URL=""
62 63
 
63 64
 # The services users usually in the service tenant.
64 65
 # rc files for service users, is out of scope.
... ...
@@ -79,6 +81,7 @@ while [ $# -gt 0 ]; do
79 79
     --os-auth-url) export OS_AUTH_URL=$2; shift ;;
80 80
     --os-cacert) export OS_CACERT=$2; shift ;;
81 81
     --target-dir) ACCOUNT_DIR=$2; shift ;;
82
+    --heat-url) HEAT_URL=$2; shift ;;
82 83
     --debug) set -o xtrace ;;
83 84
     -u) MODE=${MODE:-one};  USER_NAME=$2; shift ;;
84 85
     -p) USER_PASS=$2; shift ;;
... ...
@@ -209,6 +212,10 @@ EOF
209 209
     if [ -n "$ADDPASS" ]; then
210 210
         echo "export OS_PASSWORD=\"$user_passwd\"" >>"$rcfile"
211 211
     fi
212
+    if [ -n "$HEAT_URL" ]; then
213
+        echo "export HEAT_URL=\"$HEAT_URL/$tenant_id\"" >>"$rcfile"
214
+        echo "export OS_NO_CLIENT_AUTH=True" >>"$rcfile"
215
+    fi
212 216
 }
213 217
 
214 218
 #admin users expected