From fdd6a5f537ad39e092f69bc05307ae7640384430 Mon Sep 17 00:00:00 2001 From: Feilong Wang Date: Tue, 3 Jul 2018 06:59:58 +1200 Subject: [PATCH] Add region_name for heat-config-notify Now there is no region name when heat-config-notify try to get the heat endpoint or zaqar endpoint. As a result, it could be a wrong one returned from Keystone because there is no region name specified. This patch fixes it. Please refer Iec6f3606c9fdf8474f393b0990356f34d38bcf75 for the change in Heat. Please refer I88182a9a9af74e9760b2ec9b500971f06293f0b8 for the change in occ. Task: 22720 Story: 2002781 Change-Id: I8e0518fa61e237ec055834dd4bebe0fc87cd6627 --- heat-config/bin/heat-config-notify | 6 ++++-- heat-config/os-apply-config/etc/os-collect-config.conf | 2 ++ tests/test_heat_config_notify.py | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/heat-config/bin/heat-config-notify b/heat-config/bin/heat-config-notify index 30eb8c4..b2b35f2 100755 --- a/heat-config/bin/heat-config-notify +++ b/heat-config/bin/heat-config-notify @@ -139,7 +139,8 @@ def main(argv=sys.argv, stdin=sys.stdin): password=iv['deploy_password'], project_id=iv['deploy_project_id']) endpoint = ks.service_catalog.url_for( - service_type='messaging', endpoint_type='publicURL') + service_type='messaging', endpoint_type='publicURL', + region_name=iv.get('deploy_region_name')) conf = { 'auth_opts': { @@ -162,7 +163,8 @@ def main(argv=sys.argv, stdin=sys.stdin): password=iv['deploy_password'], project_id=iv['deploy_project_id']) endpoint = ks.service_catalog.url_for( - service_type='orchestration', endpoint_type='publicURL') + service_type='orchestration', endpoint_type='publicURL', + region_name=iv.get('deploy_region_name')) log.debug('Signalling to %s' % endpoint) heat = heatclient.Client( '1', endpoint, token=ks.auth_token) diff --git a/heat-config/os-apply-config/etc/os-collect-config.conf b/heat-config/os-apply-config/etc/os-collect-config.conf index 3a9ab36..0206dd7 100644 --- a/heat-config/os-apply-config/etc/os-collect-config.conf +++ b/heat-config/os-apply-config/etc/os-collect-config.conf @@ -41,6 +41,7 @@ password = {{password}} project_id = {{project_id}} stack_id = {{stack_id}} resource_name = {{resource_name}} +region_name = {{region_name}} {{/heat}} {{#zaqar}} @@ -50,6 +51,7 @@ user_id = {{user_id}} password = {{password}} project_id = {{project_id}} queue_id = {{queue_id}} +region_name = {{region_name}} {{#use_websockets}} use_websockets = {{.}} {{/use_websockets}} diff --git a/tests/test_heat_config_notify.py b/tests/test_heat_config_notify.py index a037934..fdea721 100644 --- a/tests/test_heat_config_notify.py +++ b/tests/test_heat_config_notify.py @@ -68,6 +68,9 @@ class HeatConfigNotifyTest(common.RunScriptTest): }, { 'name': 'deploy_resource_name', 'value': 'the_resource' + }, { + 'name': 'deploy_region_name', + 'value': 'RegionOne' }], 'config': 'five' } @@ -237,7 +240,8 @@ class HeatConfigNotifyTest(common.RunScriptTest): password='password', project_id='bbbb') ks.service_catalog.url_for.assert_called_once_with( - service_type='orchestration', endpoint_type='publicURL') + service_type='orchestration', endpoint_type='publicURL', + region_name='RegionOne') heatclient.Client.assert_called_once_with( '1', 'mock://192.0.2.3/heat', token=ks.auth_token)