Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Mate Lakat | 45ea081 | 2013-09-25 10:00:29 +0100 | [diff] [blame] | 3 | # lib/heat |
Dean Troyer | 6d04fd7 | 2012-12-21 11:03:37 -0600 | [diff] [blame] | 4 | # Install and start **Heat** service |
| 5 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 6 | # To enable, add the following to localrc |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 7 | # |
| 8 | # ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 9 | |
| 10 | # Dependencies: |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 11 | # |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 12 | # - functions |
| 13 | |
| 14 | # stack.sh |
| 15 | # --------- |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 16 | # - install_heatclient |
| 17 | # - install_heat |
| 18 | # - configure_heatclient |
| 19 | # - configure_heat |
| 20 | # - init_heat |
| 21 | # - start_heat |
| 22 | # - stop_heat |
| 23 | # - cleanup_heat |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 24 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 25 | # Save trace setting |
| 26 | XTRACE=$(set +o | grep xtrace) |
| 27 | set +o xtrace |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 28 | |
| 29 | |
| 30 | # Defaults |
| 31 | # -------- |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 32 | |
| 33 | # set up default directories |
Sean Dague | e08ab10 | 2014-11-13 17:09:28 -0500 | [diff] [blame] | 34 | GITDIR["python-heatclient"]=$DEST/python-heatclient |
Sean Dague | 5cb1906 | 2014-11-01 01:37:45 +0100 | [diff] [blame] | 35 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 36 | HEAT_DIR=$DEST/heat |
Steve Baker | 315971d | 2014-05-27 12:24:18 +1200 | [diff] [blame] | 37 | HEAT_CFNTOOLS_DIR=$DEST/heat-cfntools |
| 38 | HEAT_TEMPLATES_REPO_DIR=$DEST/heat-templates |
Steve Baker | c324908 | 2013-04-09 13:41:47 +1200 | [diff] [blame] | 39 | HEAT_AUTH_CACHE_DIR=${HEAT_AUTH_CACHE_DIR:-/var/cache/heat} |
Steve Baker | 389b3a0 | 2013-08-01 10:44:09 +1200 | [diff] [blame] | 40 | HEAT_STANDALONE=`trueorfalse False $HEAT_STANDALONE` |
Angus Salkeld | f645a85 | 2013-08-26 10:13:36 +1000 | [diff] [blame] | 41 | HEAT_CONF_DIR=/etc/heat |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 42 | HEAT_CONF=$HEAT_CONF_DIR/heat.conf |
Angus Salkeld | f645a85 | 2013-08-26 10:13:36 +1000 | [diff] [blame] | 43 | HEAT_ENV_DIR=$HEAT_CONF_DIR/environment.d |
Angus Salkeld | fb71a27 | 2013-08-26 10:15:38 +1000 | [diff] [blame] | 44 | HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates |
Steve Baker | 16aca8a | 2014-03-11 14:01:57 +1300 | [diff] [blame] | 45 | HEAT_STACK_DOMAIN=`trueorfalse True $HEAT_STACK_DOMAIN` |
Steve Baker | e389aed | 2014-09-23 17:10:39 +1200 | [diff] [blame] | 46 | HEAT_API_HOST=${HEAT_API_HOST:-$HOST_IP} |
| 47 | HEAT_API_PORT=${HEAT_API_PORT:-8004} |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 48 | |
Steven Hardy | f83cf93 | 2014-03-12 16:54:01 +0000 | [diff] [blame] | 49 | # other default options |
| 50 | HEAT_DEFERRED_AUTH=${HEAT_DEFERRED_AUTH:-trusts} |
| 51 | |
Dean Troyer | 4237f59 | 2014-01-29 16:22:11 -0600 | [diff] [blame] | 52 | # Tell Tempest this project is present |
| 53 | TEMPEST_SERVICES+=,heat |
| 54 | |
| 55 | |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 56 | # Functions |
| 57 | # --------- |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 58 | |
Sean Dague | 29870cc | 2014-03-14 14:32:01 -0400 | [diff] [blame] | 59 | # Test if any Heat services are enabled |
| 60 | # is_heat_enabled |
| 61 | function is_heat_enabled { |
| 62 | [[ ,${ENABLED_SERVICES} =~ ,"h-" ]] && return 0 |
| 63 | return 1 |
| 64 | } |
| 65 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 66 | # cleanup_heat() - Remove residual data files, anything left over from previous |
| 67 | # runs that a clean run would need to clean up |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 68 | function cleanup_heat { |
Steve Baker | c324908 | 2013-04-09 13:41:47 +1200 | [diff] [blame] | 69 | sudo rm -rf $HEAT_AUTH_CACHE_DIR |
Angus Salkeld | f645a85 | 2013-08-26 10:13:36 +1000 | [diff] [blame] | 70 | sudo rm -rf $HEAT_ENV_DIR |
Angus Salkeld | fb71a27 | 2013-08-26 10:15:38 +1000 | [diff] [blame] | 71 | sudo rm -rf $HEAT_TEMPLATES_DIR |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | # configure_heat() - Set config files, create data dirs, etc |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 75 | function configure_heat { |
Steve Baker | e389aed | 2014-09-23 17:10:39 +1200 | [diff] [blame] | 76 | if [[ "$HEAT_STANDALONE" = "True" ]]; then |
| 77 | setup_develop $HEAT_DIR/contrib/heat_keystoneclient_v2 |
| 78 | fi |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 79 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 80 | if [[ ! -d $HEAT_CONF_DIR ]]; then |
| 81 | sudo mkdir -p $HEAT_CONF_DIR |
| 82 | fi |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 83 | sudo chown $STACK_USER $HEAT_CONF_DIR |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 84 | # remove old config files |
| 85 | rm -f $HEAT_CONF_DIR/heat-*.conf |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 86 | |
Steve Baker | e61bc61 | 2014-01-27 15:21:29 +1300 | [diff] [blame] | 87 | HEAT_API_CFN_HOST=${HEAT_API_CFN_HOST:-$HOST_IP} |
Angus Salkeld | e279021 | 2012-09-11 11:24:09 +1000 | [diff] [blame] | 88 | HEAT_API_CFN_PORT=${HEAT_API_CFN_PORT:-8000} |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 89 | HEAT_ENGINE_HOST=${HEAT_ENGINE_HOST:-$SERVICE_HOST} |
| 90 | HEAT_ENGINE_PORT=${HEAT_ENGINE_PORT:-8001} |
Steve Baker | e61bc61 | 2014-01-27 15:21:29 +1300 | [diff] [blame] | 91 | HEAT_API_CW_HOST=${HEAT_API_CW_HOST:-$HOST_IP} |
Angus Salkeld | e279021 | 2012-09-11 11:24:09 +1000 | [diff] [blame] | 92 | HEAT_API_CW_PORT=${HEAT_API_CW_PORT:-8003} |
Steve Baker | d5cd79b | 2013-04-13 11:14:41 -0700 | [diff] [blame] | 93 | HEAT_API_PASTE_FILE=$HEAT_CONF_DIR/api-paste.ini |
| 94 | HEAT_POLICY_FILE=$HEAT_CONF_DIR/policy.json |
| 95 | |
| 96 | cp $HEAT_DIR/etc/heat/api-paste.ini $HEAT_API_PASTE_FILE |
| 97 | cp $HEAT_DIR/etc/heat/policy.json $HEAT_POLICY_FILE |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 98 | |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 99 | # common options |
| 100 | iniset_rpc_backend heat $HEAT_CONF DEFAULT |
| 101 | iniset $HEAT_CONF DEFAULT heat_metadata_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT |
| 102 | iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1/waitcondition |
| 103 | iniset $HEAT_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST:$HEAT_API_CW_PORT |
Angus Salkeld | e231438 | 2013-11-14 14:36:46 +1100 | [diff] [blame] | 104 | iniset $HEAT_CONF database connection `database_connection_url heat` |
Attila Fazekas | f71b500 | 2014-05-28 09:52:22 +0200 | [diff] [blame] | 105 | iniset $HEAT_CONF DEFAULT auth_encryption_key $(generate_hex_string 16) |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 106 | |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 107 | iniset $HEAT_CONF DEFAULT region_name_for_services "$REGION_NAME" |
| 108 | |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 109 | # logging |
| 110 | iniset $HEAT_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
| 111 | iniset $HEAT_CONF DEFAULT use_syslog $SYSLOG |
Steve Baker | 556ffe4 | 2013-08-06 16:42:38 +1200 | [diff] [blame] | 112 | if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
| 113 | # Add color to logging output |
Arata Notsu | 4897ff5 | 2013-10-09 18:49:32 +0900 | [diff] [blame] | 114 | setup_colorized_logging $HEAT_CONF DEFAULT tenant user |
Steve Baker | 556ffe4 | 2013-08-06 16:42:38 +1200 | [diff] [blame] | 115 | fi |
| 116 | |
Brant Knudson | 0595237 | 2014-09-19 17:22:22 -0500 | [diff] [blame] | 117 | configure_auth_token_middleware $HEAT_CONF heat $HEAT_AUTH_CACHE_DIR |
Angus Salkeld | e279021 | 2012-09-11 11:24:09 +1000 | [diff] [blame] | 118 | |
Rob Crittenden | fefd64b | 2014-05-27 22:27:15 -0400 | [diff] [blame] | 119 | if is_ssl_enabled_service "key"; then |
Rob Crittenden | 18d4778 | 2014-03-19 17:47:42 -0400 | [diff] [blame] | 120 | iniset $HEAT_CONF clients_keystone ca_file $SSL_BUNDLE_FILE |
Rob Crittenden | fefd64b | 2014-05-27 22:27:15 -0400 | [diff] [blame] | 121 | fi |
| 122 | |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 123 | # ec2authtoken |
Jamie Lennox | 3561d7f | 2014-05-21 17:18:43 +1000 | [diff] [blame] | 124 | iniset $HEAT_CONF ec2authtoken auth_uri $KEYSTONE_SERVICE_URI/v2.0 |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 125 | |
| 126 | # paste_deploy |
Steve Baker | e389aed | 2014-09-23 17:10:39 +1200 | [diff] [blame] | 127 | if [[ "$HEAT_STANDALONE" = "True" ]]; then |
| 128 | iniset $HEAT_CONF paste_deploy flavor standalone |
| 129 | iniset $HEAT_CONF DEFAULT keystone_backend heat_keystoneclient_v2.client.KeystoneClientV2 |
| 130 | iniset $HEAT_CONF clients_heat url "http://$HEAT_API_HOST:$HEAT_API_PORT/v1/%(tenant_id)s" |
| 131 | fi |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 132 | |
| 133 | # OpenStack API |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 134 | iniset $HEAT_CONF heat_api bind_port $HEAT_API_PORT |
| 135 | |
| 136 | # Cloudformation API |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 137 | iniset $HEAT_CONF heat_api_cfn bind_port $HEAT_API_CFN_PORT |
| 138 | |
| 139 | # Cloudwatch API |
Angus Salkeld | a213e2c | 2013-08-30 10:48:46 +1000 | [diff] [blame] | 140 | iniset $HEAT_CONF heat_api_cloudwatch bind_port $HEAT_API_CW_PORT |
Angus Salkeld | e279021 | 2012-09-11 11:24:09 +1000 | [diff] [blame] | 141 | |
Rob Crittenden | 18d4778 | 2014-03-19 17:47:42 -0400 | [diff] [blame] | 142 | if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then |
| 143 | iniset $HEAT_CONF clients_keystone ca_file $SSL_BUNDLE_FILE |
| 144 | fi |
| 145 | |
| 146 | if is_ssl_enabled_service "nova" || is_service_enabled tls-proxy; then |
| 147 | iniset $HEAT_CONF clients_nova ca_file $SSL_BUNDLE_FILE |
| 148 | fi |
| 149 | |
| 150 | if is_ssl_enabled_service "cinder" || is_service_enabled tls-proxy; then |
| 151 | iniset $HEAT_CONF clients_cinder ca_file $SSL_BUNDLE_FILE |
| 152 | fi |
| 153 | |
Angus Salkeld | f645a85 | 2013-08-26 10:13:36 +1000 | [diff] [blame] | 154 | # heat environment |
| 155 | sudo mkdir -p $HEAT_ENV_DIR |
| 156 | sudo chown $STACK_USER $HEAT_ENV_DIR |
| 157 | # copy the default environment |
| 158 | cp $HEAT_DIR/etc/heat/environment.d/* $HEAT_ENV_DIR/ |
| 159 | |
Angus Salkeld | fb71a27 | 2013-08-26 10:15:38 +1000 | [diff] [blame] | 160 | # heat template resources. |
| 161 | sudo mkdir -p $HEAT_TEMPLATES_DIR |
| 162 | sudo chown $STACK_USER $HEAT_TEMPLATES_DIR |
| 163 | # copy the default templates |
| 164 | cp $HEAT_DIR/etc/heat/templates/* $HEAT_TEMPLATES_DIR/ |
| 165 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | # init_heat() - Initialize database |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 169 | function init_heat { |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 170 | |
| 171 | # (re)create heat database |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 172 | recreate_database heat utf8 |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 173 | |
Steve Baker | e311132 | 2013-06-19 13:57:31 +1200 | [diff] [blame] | 174 | $HEAT_DIR/bin/heat-manage db_sync |
Steve Baker | c324908 | 2013-04-09 13:41:47 +1200 | [diff] [blame] | 175 | create_heat_cache_dir |
| 176 | } |
| 177 | |
| 178 | # create_heat_cache_dir() - Part of the init_heat() process |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 179 | function create_heat_cache_dir { |
Steve Baker | c324908 | 2013-04-09 13:41:47 +1200 | [diff] [blame] | 180 | # Create cache dirs |
Angus Salkeld | e118655 | 2013-09-06 13:35:09 +1000 | [diff] [blame] | 181 | sudo mkdir -p $HEAT_AUTH_CACHE_DIR |
| 182 | sudo chown $STACK_USER $HEAT_AUTH_CACHE_DIR |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 183 | } |
| 184 | |
Steve Baker | 32761a4 | 2012-11-05 09:57:57 +1300 | [diff] [blame] | 185 | # install_heatclient() - Collect source and prepare |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 186 | function install_heatclient { |
Sean Dague | e08ab10 | 2014-11-13 17:09:28 -0500 | [diff] [blame] | 187 | if use_library_from_git "python-heatclient"; then |
| 188 | git_clone_by_name "python-heatclient" |
| 189 | setup_dev_lib "python-heatclient" |
| 190 | sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-heatclient"]}/tools/,/etc/bash_completion.d/}heat.bash_completion |
Sean Dague | 5cb1906 | 2014-11-01 01:37:45 +0100 | [diff] [blame] | 191 | fi |
Steve Baker | 32761a4 | 2012-11-05 09:57:57 +1300 | [diff] [blame] | 192 | } |
| 193 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 194 | # install_heat() - Collect source and prepare |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 195 | function install_heat { |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 196 | git_clone $HEAT_REPO $HEAT_DIR $HEAT_BRANCH |
Sergey Kraynev | a38bc5b | 2014-12-16 04:25:11 -0500 | [diff] [blame^] | 197 | setup_develop $HEAT_DIR |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 198 | } |
| 199 | |
Steve Baker | 315971d | 2014-05-27 12:24:18 +1200 | [diff] [blame] | 200 | # install_heat_other() - Collect source and prepare |
| 201 | function install_heat_other { |
| 202 | git_clone $HEAT_CFNTOOLS_REPO $HEAT_CFNTOOLS_DIR $HEAT_CFNTOOLS_BRANCH |
| 203 | git_clone $HEAT_TEMPLATES_REPO $HEAT_TEMPLATES_REPO_DIR $HEAT_TEMPLATES_BRANCH |
| 204 | } |
| 205 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 206 | # start_heat() - Start running processes, including screen |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 207 | function start_heat { |
Chris Dent | 2f27a0e | 2014-09-09 13:46:02 +0100 | [diff] [blame] | 208 | run_process h-eng "$HEAT_DIR/bin/heat-engine --config-file=$HEAT_CONF" |
| 209 | run_process h-api "$HEAT_DIR/bin/heat-api --config-file=$HEAT_CONF" |
| 210 | run_process h-api-cfn "$HEAT_DIR/bin/heat-api-cfn --config-file=$HEAT_CONF" |
| 211 | run_process h-api-cw "$HEAT_DIR/bin/heat-api-cloudwatch --config-file=$HEAT_CONF" |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 212 | } |
| 213 | |
Dean Troyer | 699a29f | 2012-09-10 14:10:27 -0500 | [diff] [blame] | 214 | # stop_heat() - Stop running processes |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 215 | function stop_heat { |
Kieran Spear | 7033829 | 2013-05-28 11:31:31 +1000 | [diff] [blame] | 216 | # Kill the screen windows |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 217 | local serv |
Kieran Spear | 7033829 | 2013-05-28 11:31:31 +1000 | [diff] [blame] | 218 | for serv in h-eng h-api h-api-cfn h-api-cw; do |
Chris Dent | 2f27a0e | 2014-09-09 13:46:02 +0100 | [diff] [blame] | 219 | stop_process $serv |
Dean Troyer | 699a29f | 2012-09-10 14:10:27 -0500 | [diff] [blame] | 220 | done |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 221 | } |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 222 | |
Steven Hardy | 33d1f86 | 2014-02-13 15:00:33 +0000 | [diff] [blame] | 223 | # create_heat_accounts() - Set up common required heat accounts |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 224 | function create_heat_accounts { |
Steven Hardy | 57d478d | 2014-02-28 16:37:43 +0000 | [diff] [blame] | 225 | # migrated from files/keystone_data.sh |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 226 | local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") |
| 227 | local admin_role=$(openstack role list | awk "/ admin / { print \$2 }") |
Steven Hardy | 57d478d | 2014-02-28 16:37:43 +0000 | [diff] [blame] | 228 | |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 229 | local heat_user=$(get_or_create_user "heat" \ |
| 230 | "$SERVICE_PASSWORD" $service_tenant) |
| 231 | get_or_add_user_role $admin_role $heat_user $service_tenant |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 232 | |
Steven Hardy | 57d478d | 2014-02-28 16:37:43 +0000 | [diff] [blame] | 233 | if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 234 | |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 235 | local heat_service=$(get_or_create_service "heat" \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 236 | "orchestration" "Heat Orchestration Service") |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 237 | get_or_create_endpoint $heat_service \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 238 | "$REGION_NAME" \ |
| 239 | "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \ |
| 240 | "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \ |
| 241 | "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" |
| 242 | |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 243 | local heat_cfn_service=$(get_or_create_service "heat-cfn" \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 244 | "cloudformation" "Heat CloudFormation Service") |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 245 | get_or_create_endpoint $heat_cfn_service \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 246 | "$REGION_NAME" \ |
| 247 | "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \ |
| 248 | "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \ |
| 249 | "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" |
Steven Hardy | 57d478d | 2014-02-28 16:37:43 +0000 | [diff] [blame] | 250 | fi |
| 251 | |
| 252 | # heat_stack_user role is for users created by Heat |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 253 | get_or_create_role "heat_stack_user" |
Steven Hardy | 57d478d | 2014-02-28 16:37:43 +0000 | [diff] [blame] | 254 | |
Steven Hardy | f83cf93 | 2014-03-12 16:54:01 +0000 | [diff] [blame] | 255 | if [[ $HEAT_DEFERRED_AUTH == trusts ]]; then |
Steven Hardy | f83cf93 | 2014-03-12 16:54:01 +0000 | [diff] [blame] | 256 | iniset $HEAT_CONF DEFAULT deferred_auth_method trusts |
| 257 | fi |
Steven Hardy | 2ca3bf1 | 2014-03-03 18:07:33 +0000 | [diff] [blame] | 258 | |
Steve Baker | 16aca8a | 2014-03-11 14:01:57 +1300 | [diff] [blame] | 259 | if [[ "$HEAT_STACK_DOMAIN" == "True" ]]; then |
| 260 | # Note we have to pass token/endpoint here because the current endpoint and |
| 261 | # version negotiation in OSC means just --os-identity-api-version=3 won't work |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 262 | local ks_endpoint_v3="$KEYSTONE_SERVICE_URI/v3" |
Steven Hardy | dd029da | 2014-02-24 18:09:10 +0000 | [diff] [blame] | 263 | |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 264 | D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 265 | --os-identity-api-version=3 domain list | grep ' heat ' | get_field 1) |
| 266 | |
| 267 | if [[ -z "$D_ID" ]]; then |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 268 | D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 269 | --os-identity-api-version=3 domain create heat \ |
| 270 | --description "Owns users and projects created by heat" \ |
| 271 | | grep ' id ' | get_field 2) |
Sirushti Murugesan | 2f92c8d | 2014-10-09 14:35:38 +0530 | [diff] [blame] | 272 | iniset $HEAT_CONF DEFAULT stack_user_domain_id ${D_ID} |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 273 | |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 274 | openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 275 | --os-identity-api-version=3 user create --password $SERVICE_PASSWORD \ |
| 276 | --domain $D_ID heat_domain_admin \ |
| 277 | --description "Manages users and projects created by heat" |
Dean Troyer | 7d31bdc | 2014-07-25 12:50:05 -0500 | [diff] [blame] | 278 | openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \ |
Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 279 | --os-identity-api-version=3 role add \ |
| 280 | --user heat_domain_admin --domain ${D_ID} admin |
| 281 | iniset $HEAT_CONF DEFAULT stack_domain_admin heat_domain_admin |
| 282 | iniset $HEAT_CONF DEFAULT stack_domain_admin_password $SERVICE_PASSWORD |
| 283 | fi |
Steve Baker | 16aca8a | 2014-03-11 14:01:57 +1300 | [diff] [blame] | 284 | fi |
Steven Hardy | 33d1f86 | 2014-02-13 15:00:33 +0000 | [diff] [blame] | 285 | } |
| 286 | |
Steve Baker | 2a6009c | 2014-05-05 16:13:39 +1200 | [diff] [blame] | 287 | # build_heat_functional_test_image() - Build and upload functional test image |
| 288 | function build_heat_functional_test_image { |
| 289 | build_dib_pip_repo "$OCC_DIR $OAC_DIR $ORC_DIR $HEAT_CFNTOOLS_DIR" |
| 290 | local image_name=heat-functional-tests-image |
| 291 | |
| 292 | # The elements to invoke disk-image-create with |
| 293 | local image_elements="vm fedora selinux-permissive pypi \ |
| 294 | os-collect-config os-refresh-config os-apply-config heat-cfntools \ |
| 295 | heat-config heat-config-cfn-init heat-config-puppet heat-config-script" |
| 296 | |
| 297 | # Elements path for tripleo-image-elements and heat-templates software-config |
| 298 | local elements_path=$TIE_DIR/elements:$HEAT_TEMPLATES_REPO_DIR/hot/software-config/elements |
| 299 | |
| 300 | disk_image_create_upload "$image_name" "$image_elements" "$elements_path" |
| 301 | iniset $TEMPEST_CONFIG orchestration image_ref $image_name |
| 302 | } |
| 303 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 304 | # Restore xtrace |
| 305 | $XTRACE |
Sean Dague | 584d90e | 2013-03-29 14:34:53 -0400 | [diff] [blame] | 306 | |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 307 | # Tell emacs to use shell-script-mode |
| 308 | ## Local variables: |
| 309 | ## mode: shell-script |
| 310 | ## End: |