Merge "SignalResponder _get_signed_url should use cloudformation endpoint"

This commit is contained in:
Jenkins 2015-06-09 17:58:15 +00:00 committed by Gerrit Code Review
commit 9c550d729a
6 changed files with 29 additions and 9 deletions

View File

@ -63,3 +63,10 @@ class HeatClientPlugin(client_plugin.ClientPlugin):
heat_url = self.url_for(service_type='orchestration',
endpoint_type=endpoint_type)
return heat_url
def get_heat_cfn_url(self):
endpoint_type = self._get_client_option('heat',
'endpoint_type')
heat_cfn_url = self.url_for(service_type='cloudformation',
endpoint_type=endpoint_type)
return heat_cfn_url

View File

@ -73,7 +73,7 @@ class SignalResponder(stack_user.StackUser):
signal_url = config_url.replace('/waitcondition', signal_type)
else:
heat_client_plugin = self.stack.clients.client_plugin('heat')
endpoint = heat_client_plugin.get_heat_url()
endpoint = heat_client_plugin.get_heat_cfn_url()
signal_url = ''.join([endpoint, signal_type])
host_url = urlparse.urlparse(signal_url)

View File

@ -213,8 +213,8 @@ class ScalingPolicyAttrTest(common.HeatTestCase):
def test_alarm_attribute(self):
self.m.StubOutWithMock(self.stack.clients.client_plugin('heat'),
'get_heat_url')
self.stack.clients.client_plugin('heat').get_heat_url().AndReturn(
'get_heat_cfn_url')
self.stack.clients.client_plugin('heat').get_heat_cfn_url().AndReturn(
'http://server.test:8000/v1')
self.m.ReplayAll()
alarm_url = self.policy.FnGetAtt('alarm_url')

View File

@ -385,8 +385,8 @@ class WaitConditionHandleTest(common.HeatTestCase):
stack_name=stack_name)
self.m.StubOutWithMock(self.stack.clients.client_plugin('heat'),
'get_heat_url')
self.stack.clients.client_plugin('heat').get_heat_url().AndReturn(
'get_heat_cfn_url')
self.stack.clients.client_plugin('heat').get_heat_cfn_url().AndReturn(
'http://server.test:8000/v1')
self.m.ReplayAll()
rsrc = self.stack['WaitHandle']

View File

@ -72,6 +72,19 @@ class ClientsTest(common.HeatTestCase):
obj._get_client_option.return_value = result
self.assertEqual(result, obj.get_heat_url())
def test_clients_get_heat_cfn_url(self):
con = mock.Mock()
c = clients.Clients(con)
con.clients = c
obj = c.client_plugin('heat')
obj._get_client_option = mock.Mock()
obj._get_client_option.return_value = None
obj.url_for = mock.Mock(name="url_for")
heat_cfn_url = "http://0.0.0.0:8000/v1"
obj.url_for.return_value = heat_cfn_url
self.assertEqual(heat_cfn_url, obj.get_heat_cfn_url())
@mock.patch.object(heatclient, 'Client')
def test_clients_heat(self, mock_call):
self.stub_keystoneclient()

View File

@ -143,9 +143,9 @@ class SignalTest(common.HeatTestCase):
def test_FnGetAtt_Alarm_Url(self):
self.stack = self.create_stack()
self.m.StubOutWithMock(self.stack.clients.client_plugin('heat'),
'get_heat_url')
'get_heat_cfn_url')
self.stack.clients.client_plugin('heat').get_heat_url().AndReturn(
self.stack.clients.client_plugin('heat').get_heat_cfn_url().AndReturn(
'http://server.test:8000/v1')
self.m.ReplayAll()
@ -188,9 +188,9 @@ class SignalTest(common.HeatTestCase):
def test_FnGetAtt_delete(self):
self.stack = self.create_stack()
self.m.StubOutWithMock(self.stack.clients.client_plugin('heat'),
'get_heat_url')
'get_heat_cfn_url')
self.stack.clients.client_plugin('heat').get_heat_url().AndReturn(
self.stack.clients.client_plugin('heat').get_heat_cfn_url().AndReturn(
'http://server.test:8000/v1')
self.m.ReplayAll()
self.stack.create()