diff --git a/devstack/lib/heat b/devstack/lib/heat index e0a2b0bae4..b6cedf920c 100644 --- a/devstack/lib/heat +++ b/devstack/lib/heat @@ -39,8 +39,8 @@ HEAT_BRANCH=${HEAT_BRANCH:-master} GITREPO["python-heatclient"]=${HEATCLIENT_REPO:-${GIT_BASE}/openstack/python-heatclient.git} GITBRANCH["python-heatclient"]=${HEATCLIENT_BRANCH:-master} -# Use HEAT_USE_MOD_WSGI for backward compatibility -HEAT_USE_APACHE=${HEAT_USE_APACHE:-${HEAT_USE_MOD_WSGI:-True}} +# Toggle for deploying Heat-API under HTTPD + mod_wsgi +HEAT_USE_MOD_WSGI=${HEAT_USE_MOD_WSGI:-True} HEAT_DIR=$DEST/heat HEAT_FILES_DIR=$HEAT_DIR/devstack/files @@ -61,15 +61,9 @@ HEAT_TRUSTEE_DOMAIN=${HEAT_TRUSTEE_DOMAIN:-default} # Support entry points installation of console scripts HEAT_BIN_DIR=$(get_python_exec_prefix) -HEAT_API_UWSGI_CONF=$HEAT_CONF_DIR/heat-uwsgi-api.ini -HEAT_CFN_API_UWSGI_CONF=$HEAT_CONF_DIR/heat-uwsgi-cfn-api.ini -HEAT_CW_API_UWSGI_CONF=$HEAT_CONF_DIR/heat-uwsgi-cw-api.ini -HEAT_API_UWSGI=$HEAT_BIN_DIR/heat-wsgi-api -HEAT_CFN_API_UWSGI=$HEAT_BIN_DIR/heat-wsgi-api-cfn -HEAT_CW_API_UWSGI=$HEAT_BIN_DIR/heat-wsgi-api-cloudwatch # other default options -if [[ "$HEAT_STANDALONE" == "True" ]]; then +if [[ "$HEAT_STANDALONE" = "True" ]]; then # for standalone, use defaults which require no service user HEAT_STACK_DOMAIN=$(trueorfalse False HEAT_STACK_DOMAIN) HEAT_DEFERRED_AUTH=${HEAT_DEFERRED_AUTH:-password} @@ -99,7 +93,7 @@ function is_heat_enabled { # cleanup_heat() - Remove residual data files, anything left over from previous # runs that a clean run would need to clean up function cleanup_heat { - if [[ "$HEAT_USE_APACHE" == "True" ]]; then + if [ "$HEAT_USE_MOD_WSGI" == "True" ]; then _cleanup_heat_apache_wsgi fi sudo rm -rf $HEAT_AUTH_CACHE_DIR @@ -129,16 +123,9 @@ function configure_heat { # common options iniset_rpc_backend heat $HEAT_CONF - if [[ "$HEAT_USE_APACHE" == "True" && "$WSGI_MODE" == "uwsgi" ]]; then - iniset $HEAT_CONF DEFAULT heat_metadata_server_url http://$HEAT_API_CFN_HOST/heat-api-cfn - iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST/heat-api-cfn/v1/waitcondition - iniset $HEAT_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST/heat-api-cloudwatch - else - iniset $HEAT_CONF DEFAULT heat_metadata_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT - iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1/waitcondition - iniset $HEAT_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST:$HEAT_API_CW_PORT - fi - + iniset $HEAT_CONF DEFAULT heat_metadata_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT + iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1/waitcondition + iniset $HEAT_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST:$HEAT_API_CW_PORT iniset $HEAT_CONF database connection `database_connection_url heat` iniset $HEAT_CONF DEFAULT auth_encryption_key $(generate_hex_string 16) @@ -147,26 +134,15 @@ function configure_heat { # logging iniset $HEAT_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL - local no_format="False" - if [[ "$HEAT_USE_APACHE" == "True" && "$WSGI_MODE" != "uwsgi" ]]; then - no_format="True" - fi - # Format logging - setup_logging $HEAT_CONF $no_format + setup_logging $HEAT_CONF $HEAT_USE_MOD_WSGI - if [[ ! -z "$HEAT_DEFERRED_AUTH" ]]; then + if [ ! -z "$HEAT_DEFERRED_AUTH" ]; then iniset $HEAT_CONF DEFAULT deferred_auth_method $HEAT_DEFERRED_AUTH fi - if [[ "$HEAT_USE_APACHE" == "True" ]]; then - if [[ $WSGI_MODE == "uwsgi" ]]; then - write_uwsgi_config "$HEAT_API_UWSGI_CONF" "$HEAT_API_UWSGI" "/heat-api" - write_uwsgi_config "$HEAT_CFN_API_UWSGI_CONF" "$HEAT_CFN_API_UWSGI" "/heat-api-cfn" - write_uwsgi_config "$HEAT_CW_API_UWSGI_CONF" "$HEAT_CW_API_UWSGI" "/heat-api-cloudwatch" - else - _config_heat_apache_wsgi - fi + if [ "$HEAT_USE_MOD_WSGI" == "True" ]; then + _config_heat_apache_wsgi fi if [[ "$HEAT_STANDALONE" = "True" ]]; then @@ -242,7 +218,7 @@ function configure_heat { # while still allowing the plugins to be edited in-tree. local err_count=0 - if [[ -n "$ENABLE_HEAT_PLUGINS" ]]; then + if [ -n "$ENABLE_HEAT_PLUGINS" ]; then mkdir -p $HEAT_PLUGIN_DIR # Clean up cruft from any previous runs rm -f $HEAT_PLUGIN_DIR/* @@ -250,7 +226,7 @@ function configure_heat { fi for heat_plugin in $ENABLE_HEAT_PLUGINS; do - if [[ -d $HEAT_DIR/contrib/$heat_plugin ]]; then + if [ -d $HEAT_DIR/contrib/$heat_plugin ]; then setup_package $HEAT_DIR/contrib/$heat_plugin -e ln -s $HEAT_DIR/contrib/$heat_plugin/$heat_plugin/resources $HEAT_PLUGIN_DIR/$heat_plugin else @@ -292,12 +268,8 @@ function install_heatclient { function install_heat { git_clone $HEAT_REPO $HEAT_DIR $HEAT_BRANCH setup_develop $HEAT_DIR - if [[ "$HEAT_USE_APACHE" == "True" ]]; then - if [ "$WSGI_MODE" == "uwsgi" ]; then - pip_install uwsgi - else - install_apache_wsgi - fi + if [ "$HEAT_USE_MOD_WSGI" == "True" ]; then + install_apache_wsgi fi } @@ -308,23 +280,17 @@ function start_heat { # If the site is not enabled then we are in a grenade scenario local enabled_site_file enabled_site_file=$(apache_site_config_for heat-api) - if [[ "$HEAT_USE_APACHE" == "True" ]]; then - if [[ -f ${enabled_site_file} && "$WSGI_MODE" != "uwsgi" ]]; then - enable_apache_site heat-api - enable_apache_site heat-api-cfn - enable_apache_site heat-api-cloudwatch - restart_apache_server - tail_log heat-api /var/log/$APACHE_NAME/heat_api.log - tail_log heat-api-access /var/log/$APACHE_NAME/heat_api_access.log - tail_log heat-api-cfn /var/log/$APACHE_NAME/heat_api_cfn.log - tail_log heat-api-cfn-access /var/log/$APACHE_NAME/heat_api_cfn_access.log - tail_log heat-api-cloudwatch /var/log/$APACHE_NAME/heat_api_cloudwatch.log - tail_log heat-api-cloudwatch-access /var/log/$APACHE_NAME/heat_api_cloudwatch_access.log - else - run_process h-api "$HEAT_BIN_DIR/uwsgi --ini $HEAT_API_UWSGI_CONF" "" - run_process h-api-cfn "$HEAT_BIN_DIR/uwsgi --ini $HEAT_CFN_API_UWSGI_CONF" "" - run_process h-api-cw "$HEAT_BIN_DIR/uwsgi --ini $HEAT_CW_API_UWSGI_CONF" "" - fi + if [ -f ${enabled_site_file} ] && [ "$HEAT_USE_MOD_WSGI" == "True" ]; then + enable_apache_site heat-api + enable_apache_site heat-api-cfn + enable_apache_site heat-api-cloudwatch + restart_apache_server + tail_log heat-api /var/log/$APACHE_NAME/heat_api.log + tail_log heat-api-access /var/log/$APACHE_NAME/heat_api_access.log + tail_log heat-api-cfn /var/log/$APACHE_NAME/heat_api_cfn.log + tail_log heat-api-cfn-access /var/log/$APACHE_NAME/heat_api_cfn_access.log + tail_log heat-api-cloudwatch /var/log/$APACHE_NAME/heat_api_cloudwatch.log + tail_log heat-api-cloudwatch-access /var/log/$APACHE_NAME/heat_api_cloudwatch_access.log else run_process h-api "$HEAT_BIN_DIR/heat-api --config-file=$HEAT_CONF" run_process h-api-cfn "$HEAT_BIN_DIR/heat-api-cfn --config-file=$HEAT_CONF" @@ -332,42 +298,27 @@ function start_heat { fi } -function _stop_processes { - local serv - for serv in h-api h-api-cfn h-api-cw; do - stop_process $serv - done -} - # stop_heat() - Stop running processes function stop_heat { # Kill the screen windows stop_process h-eng - if [[ "$HEAT_USE_APACHE" == "True" ]]; then - if [[ "$WSGI_MODE" == "uwsgi" ]]; then - remove_uwsgi_config "$HEAT_API_UWSGI_CONF" "$HEAT_API_UWSGI" - remove_uwsgi_config "$HEAT_CFN_API_UWSGI_CONF" "$HEAT_CFN_API_UWSGI" - remove_uwsgi_config "$HEAT_CW_API_UWSGI_CONF" "$HEAT_CW_API_UWSGI" - _stop_processes - else - disable_apache_site heat-api - disable_apache_site heat-api-cfn - disable_apache_site heat-api-cloudwatch - restart_apache_server - fi + if [ "$HEAT_USE_MOD_WSGI" == "True" ]; then + disable_apache_site heat-api + disable_apache_site heat-api-cfn + disable_apache_site heat-api-cloudwatch + restart_apache_server else - _stop_processes + local serv + for serv in h-api h-api-cfn h-api-cw; do + stop_process $serv + done fi + } # _cleanup_heat_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file function _cleanup_heat_apache_wsgi { - if [[ "$WSGI_MODE" == "uwsgi" ]]; then - remove_uwsgi_config "$HEAT_API_UWSGI_CONF" "$HEAT_API_UWSGI" - remove_uwsgi_config "$HEAT_CFN_API_UWSGI_CONF" "$HEAT_CFN_API_UWSGI" - remove_uwsgi_config "$HEAT_CW_API_UWSGI_CONF" "$HEAT_CW_API_UWSGI" - fi sudo rm -f $(apache_site_config_for heat-api) sudo rm -f $(apache_site_config_for heat-api-cfn) sudo rm -f $(apache_site_config_for heat-api-cloudwatch) @@ -435,29 +386,22 @@ function _config_heat_apache_wsgi { function create_heat_accounts { if [[ "$HEAT_STANDALONE" != "True" ]]; then - local heat_api_service_url - local heat_cfn_api_service_url - - if [[ "$HEAT_USE_APACHE" == "True" && "$WSGI_MODE" == "uwsgi" ]]; then - heat_api_service_url="$SERVICE_PROTOCOL://$HEAT_API_HOST/heat-api/v1/\$(project_id)s" - heat_cfn_api_service_url="$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST/heat-api-cfn/v1" - else - heat_api_service_url="$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s" - heat_cfn_api_service_url="$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" - fi - create_service_user "heat" "admin" get_or_create_service "heat" "orchestration" "Heat Orchestration Service" get_or_create_endpoint \ "orchestration" \ "$REGION_NAME" \ - "$heat_api_service_url" "$heat_api_service_url" "$heat_api_service_url" + "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s" \ + "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s" \ + "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s" get_or_create_service "heat-cfn" "cloudformation" "Heat CloudFormation Service" get_or_create_endpoint \ "cloudformation" \ "$REGION_NAME" \ - "$heat_cfn_api_service_url" "$heat_cfn_api_service_url" "$heat_cfn_api_service_url" + "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \ + "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \ + "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" # heat_stack_user role is for users created by Heat get_or_create_role "heat_stack_user" diff --git a/heat/common/identifier.py b/heat/common/identifier.py index 6d39569a68..dc2ee6b340 100644 --- a/heat/common/identifier.py +++ b/heat/common/identifier.py @@ -100,7 +100,7 @@ class HeatIdentifier(collections.Mapping): def arn_url_path(self): """Return an ARN quoted correctly for use in a URL.""" - return '/' + urlparse.quote(self.arn()) + return '/' + urlparse.quote(self.arn(), '') def url_path(self): """Return a URL-encoded path segment of a URL. diff --git a/heat/tests/autoscaling/test_heat_scaling_policy.py b/heat/tests/autoscaling/test_heat_scaling_policy.py index 3158dab24a..3e46b5fc00 100644 --- a/heat/tests/autoscaling/test_heat_scaling_policy.py +++ b/heat/tests/autoscaling/test_heat_scaling_policy.py @@ -300,7 +300,7 @@ class ScalingPolicyAttrTest(common.HeatTestCase): self.assertEqual('heat', base[2]) self.assertEqual('test_tenant_id', base[4]) - res = base[5].split('/') + res = base[5].split('%2F') self.assertEqual('stacks', res[0]) self.assertEqual(self.stack_name, res[1]) self.assertEqual('resources', res[3]) diff --git a/heat/tests/test_identifier.py b/heat/tests/test_identifier.py index 145f11616e..d9ebf8b2c9 100644 --- a/heat/tests/test_identifier.py +++ b/heat/tests/test_identifier.py @@ -57,7 +57,7 @@ class IdentifierTest(common.HeatTestCase): def test_arn_url(self): hi = identifier.HeatIdentifier('t', 's', 'i', 'p') - self.assertEqual('/arn%3Aopenstack%3Aheat%3A%3At%3Astacks/s/i/p', + self.assertEqual('/arn%3Aopenstack%3Aheat%3A%3At%3Astacks%2Fs%2Fi%2Fp', hi.arn_url_path()) def test_arn_id_int(self): @@ -208,7 +208,7 @@ class IdentifierTest(common.HeatTestCase): self.assertEqual(arn, hi.arn()) def test_arn_url_parse_round_trip(self): - arn = '/arn%3Aopenstack%3Aheat%3A%3At%3Astacks/s/i/p' + arn = '/arn%3Aopenstack%3Aheat%3A%3At%3Astacks%2Fs%2Fi%2Fp' url = 'http://1.2.3.4/foo' + arn hi = identifier.HeatIdentifier.from_arn_url(url) self.assertEqual(arn, hi.arn_url_path()) diff --git a/heat/tests/test_signal.py b/heat/tests/test_signal.py index a5bdaf600f..2cd9c2171c 100644 --- a/heat/tests/test_signal.py +++ b/heat/tests/test_signal.py @@ -173,8 +173,8 @@ class SignalTest(common.HeatTestCase): # done for comparison expected_url_path = "".join([ 'http://server.test:8000/v1/signal/', - 'arn%3Aopenstack%3Aheat%3A%3Atest_tenant%3Astacks/', - 'FnGetAtt-alarm-url/FnGetAtt-alarm-url/resources/', + 'arn%3Aopenstack%3Aheat%3A%3Atest_tenant%3Astacks%2F', + 'FnGetAtt-alarm-url%2FFnGetAtt-alarm-url%2Fresources%2F', 'signal_handler']) expected_url_params = { 'Timestamp': ['2012-11-29T13:49:37Z'], diff --git a/heat_integrationtests/prepare_test_env.sh b/heat_integrationtests/prepare_test_env.sh index 3476438f6d..422e9eac0d 100755 --- a/heat_integrationtests/prepare_test_env.sh +++ b/heat_integrationtests/prepare_test_env.sh @@ -65,8 +65,7 @@ iniset $conf_file heat_plugin heat_config_notify_script $DEST/heat-templates/hot iniset $conf_file heat_plugin minimal_image_ref cirros-0.3.5-x86_64-disk # Skip test_cancel_update_server_with_port till bug #1607714 is fixed in nova -# Skip ReloadOnSighupTest. Most jobs now run with apache+uwsgi, so the test has no significance -iniset $conf_file heat_plugin skip_functional_test_list 'CancelUpdateTest.test_cancel_update_server_with_port, ReloadOnSighupTest, StackSnapshotRestoreTest' +iniset $conf_file heat_plugin skip_functional_test_list 'CancelUpdateTest.test_cancel_update_server_with_port, StackSnapshotRestoreTest' # Add scenario tests to skip # VolumeBackupRestoreIntegrationTest skipped until failure rate can be reduced ref bug #1382300