Merge "Don't treat ResourceDefinition as cfn template in resources"

This commit is contained in:
Jenkins 2016-05-16 07:47:14 +00:00 committed by Gerrit Code Review
commit 99074df4b2
5 changed files with 9 additions and 12 deletions

View File

@ -749,7 +749,8 @@ class WebHook(resource.Resource):
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
asclient = self.auto_scale()
args = self._get_args(json_snippet['Properties'])
args = self._get_args(json_snippet.properties(self.properties_schema,
self.context))
args['webhook'] = self.resource_id
asclient.replace_webhook(**args)

View File

@ -276,8 +276,8 @@ class InstanceGroup(stack_resource.StackResource):
def _update_timeout(self, batch_cnt, pause_sec):
total_pause_time = pause_sec * max(batch_cnt - 1, 0)
if total_pause_time >= self.stack.timeout_secs():
msg = _('The current %s will result in stack update '
'timeout.') % rsrc_defn.UPDATE_POLICY
msg = _('The current update policy will result in stack update '
'timeout.')
raise ValueError(msg)
return self.stack.timeout_secs() - total_pause_time

View File

@ -227,11 +227,8 @@ class RemoteStack(resource.Resource):
# Always issue an update to the remote stack and let the individual
# resources in it decide if they need updating.
if self.resource_id:
snippet = json_snippet.get('Properties', {})
self.properties = properties.Properties(self.properties_schema,
snippet,
function.resolve,
self.name)
self.properties = json_snippet.properties(self.properties_schema,
self.context)
params = self.properties[self.PARAMETERS]
env = environment.get_child_environment(self.stack.env, params)

View File

@ -27,7 +27,6 @@ from heat.engine import function
from heat.engine.hot import template
from heat.engine import properties
from heat.engine.resources import stack_resource
from heat.engine import rsrc_defn
from heat.engine import scheduler
from heat.engine import support
from heat.scaling import rolling_update
@ -560,8 +559,8 @@ class ResourceGroup(stack_resource.StackResource):
def _update_timeout(self, batch_cnt, pause_sec):
total_pause_time = pause_sec * max(batch_cnt - 1, 0)
if total_pause_time >= self.stack.timeout_secs():
msg = _('The current %s will result in stack update '
'timeout.') % rsrc_defn.UPDATE_POLICY
msg = _('The current update policy will result in stack update '
'timeout.')
raise ValueError(msg)
return self.stack.timeout_secs() - total_pause_time

View File

@ -1112,7 +1112,7 @@ class RollingUpdateTest(common.HeatTestCase):
self.stack.timeout_secs = mock.Mock(return_value=200)
err = self.assertRaises(ValueError, self.current_grp._update_timeout,
3, 100)
self.assertIn('The current UpdatePolicy will result in stack update '
self.assertIn('The current update policy will result in stack update '
'timeout.', six.text_type(err))
def test_update_time_sufficient(self):