Merge "Move Resource exceptions to common module (1)"

changes/15/220815/1
Jenkins 7 years ago committed by Gerrit Code Review
commit 49c4d39516
  1. 7
      heat/common/exception.py
  2. 19
      heat/engine/resource.py
  3. 2
      heat/engine/resources/aws/autoscaling/launch_config.py
  4. 4
      heat/engine/resources/aws/ec2/eip.py
  5. 3
      heat/engine/resources/openstack/heat/test_resource.py
  6. 4
      heat/engine/resources/openstack/heat/wait_condition_handle.py
  7. 3
      heat/engine/resources/openstack/monasca/alarm_definition.py
  8. 4
      heat/engine/resources/openstack/neutron/port.py
  9. 4
      heat/engine/resources/openstack/nova/server.py
  10. 4
      heat/engine/resources/stack_resource.py
  11. 6
      heat/engine/update.py
  12. 2
      heat/engine/worker.py
  13. 2
      heat/tests/aws/test_instance.py
  14. 3
      heat/tests/ceilometer/test_ceilometer_alarm.py
  15. 2
      heat/tests/engine/test_engine_worker.py
  16. 3
      heat/tests/manila/test_manila_security_service.py
  17. 2
      heat/tests/mistral/test_mistral_workflow.py
  18. 3
      heat/tests/neutron/test_neutron_port.py
  19. 10
      heat/tests/nova/test_server.py
  20. 3
      heat/tests/openstack/monasca/test_alarm_definition.py
  21. 4
      heat/tests/openstack/test_waitcondition.py
  22. 4
      heat/tests/test_cw_alarm.py
  23. 5
      heat/tests/test_hot.py
  24. 3
      heat/tests/test_instance_group.py
  25. 3
      heat/tests/test_remote_stack.py
  26. 16
      heat/tests/test_resource.py
  27. 4
      heat/tests/test_stack_resource.py
  28. 3
      heat/tests/test_stack_update.py
  29. 3
      heat/tests/test_zaqar_queue.py

@ -388,6 +388,13 @@ class PropertyUnspecifiedError(HeatException):
super(PropertyUnspecifiedError, self).__init__(**kwargs)
class UpdateReplace(Exception):
'''Raised when resource update requires replacement.'''
def __init__(self, resource_name='Unknown'):
msg = _("The Resource %s requires replacement.") % resource_name
super(Exception, self).__init__(six.text_type(msg))
class HTTPExceptionDisguise(Exception):
"""Disguises HTTP exceptions so they can be handled by the webob fault
application in the wsgi pipeline.

@ -57,13 +57,6 @@ def _register_class(resource_type, resource_class):
resources.global_env().register_class(resource_type, resource_class)
class UpdateReplace(Exception):
'''Raised when resource update requires replacement.'''
def __init__(self, resource_name='Unknown'):
msg = _("The Resource %s requires replacement.") % resource_name
super(Exception, self).__init__(six.text_type(msg))
class NoActionRequired(Exception):
pass
@ -521,7 +514,7 @@ class Resource(object):
raise exception.NotSupported(feature=mesg)
if not changed_properties_set.issubset(update_allowed_set):
raise UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
return dict((k, after_props.get(k)) for k in changed_properties_set)
@ -867,18 +860,18 @@ class Resource(object):
def _needs_update(self, after, before, after_props, before_props,
prev_resource, check_init_complete=True):
if self.status == self.FAILED:
raise UpdateReplace(self)
raise exception.UpdateReplace(self)
if check_init_complete and \
(self.action == self.INIT and self.status == self.COMPLETE):
raise UpdateReplace(self)
raise exception.UpdateReplace(self)
if prev_resource is not None:
cur_class_def, cur_ver = self.implementation_signature()
prev_class_def, prev_ver = prev_resource.implementation_signature()
if prev_class_def != cur_class_def:
raise UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
if prev_ver != cur_ver:
return True
@ -947,7 +940,7 @@ class Resource(object):
LOG.info(_LI('updating %s'), six.text_type(self))
self.updated_time = datetime.utcnow()
with self._action_recorder(action, UpdateReplace):
with self._action_recorder(action, exception.UpdateReplace):
after_props.validate()
tmpl_diff = self.update_template_diff(function.resolve(after),
before)
@ -1576,7 +1569,7 @@ class Resource(object):
def handle_update(self, json_snippet=None, tmpl_diff=None, prop_diff=None):
if prop_diff:
raise UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
def metadata_update(self, new_metadata=None):
'''

@ -218,7 +218,7 @@ class LaunchConfiguration(resource.Resource):
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
if 'Metadata' in tmpl_diff:
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
def FnGetRefId(self):
return self.physical_resource_name_or_FnGetRefId()

@ -376,7 +376,7 @@ class ElasticIpAssociation(resource.Resource):
ni_id = prop_diff.get(self.NETWORK_INTERFACE_ID)
if instance_id or ni_id:
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
# according to aws doc, when update the instance_id or
# network_interface_id, if you also change the EIP or
@ -386,7 +386,7 @@ class ElasticIpAssociation(resource.Resource):
eip = prop_diff.get(self.EIP)
allocation_id = prop_diff.get(self.ALLOCATION_ID)
if eip or allocation_id:
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
def handle_create(self):
"""Add a floating IP address to a server."""

@ -16,6 +16,7 @@ import eventlet
from oslo_utils import timeutils
import six
from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import properties
@ -156,7 +157,7 @@ class TestResource(resource.Resource):
if value:
update_replace = self.properties[self.UPDATE_REPLACE]
if update_replace:
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
else:
# emulate failure
fail_prop = self.properties[self.FAIL]

@ -13,9 +13,9 @@
import uuid
from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import resource
from heat.engine.resources.aws.cfn import wait_condition_handle as aws_wch
from heat.engine.resources import wait_condition as wc_base
from heat.engine import support
@ -141,7 +141,7 @@ class UpdateWaitConditionHandle(aws_wch.WaitConditionHandle):
support_status = support.SupportStatus(version='2014.1')
def update(self, after, before=None, prev_resource=None):
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
def resource_mapping():

@ -11,6 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.common import exception
from heat.common.i18n import _
from heat.engine import clients
from heat.engine import constraints
@ -186,7 +187,7 @@ class MonascaAlarmDefinition(resource.Resource):
except Exception as ex:
if self.client_plugin().is_un_processable(ex):
# Monasca does not allow to update the sub expression
raise resource.UpdateReplace(resource_name=self.name)
raise exception.UpdateReplace(resource_name=self.name)
def handle_delete(self):
if self.resource_id is not None:

@ -14,12 +14,12 @@
from oslo_log import log as logging
import six
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine.resources.openstack.neutron import neutron
from heat.engine.resources.openstack.neutron import subnet
from heat.engine import support
@ -415,7 +415,7 @@ class Port(neutron.NeutronResource):
prev_resource, check_init_complete=True):
if after_props.get(self.REPLACEMENT_POLICY) == 'REPLACE_ALWAYS':
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
return super(Port, self)._needs_update(
after, before, after_props, before_props, prev_resource,

@ -945,7 +945,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
flavor = prop_diff[self.FLAVOR]
if flavor_update_policy == 'REPLACE':
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
flavor_id = self.client_plugin().get_flavor_id(flavor)
handler_args = {'args': (flavor_id,)}
@ -964,7 +964,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
prop_diff.get(self.IMAGE_UPDATE_POLICY) or
self.properties[self.IMAGE_UPDATE_POLICY])
if image_update_policy == 'REPLACE':
raise resource.UpdateReplace(self.name)
raise exception.UpdateReplace(self.name)
image = prop_diff[self.IMAGE]
image_id = self.client_plugin('glance').get_image_id(image)
preserve_ephemeral = (

@ -93,12 +93,12 @@ class StackResource(resource.Resource):
# FIXME (ricolin): seems currently can not call super here
if self.nested() is None and self.status == self.FAILED:
raise resource.UpdateReplace(self)
raise exception.UpdateReplace(self)
if (check_init_complete and
self.nested() is None and
self.action == self.INIT and self.status == self.COMPLETE):
raise resource.UpdateReplace(self)
raise exception.UpdateReplace(self)
return True

@ -14,9 +14,9 @@
from oslo_log import log as logging
import six
from heat.common import exception
from heat.common.i18n import _LI
from heat.engine import dependencies
from heat.engine import resource
from heat.engine import scheduler
from heat.objects import resource as resource_objects
@ -145,7 +145,7 @@ class StackUpdate(object):
try:
yield self._update_in_place(existing_res,
new_res)
except resource.UpdateReplace:
except exception.UpdateReplace:
pass
else:
# Save updated resource definition to backup stack
@ -248,7 +248,7 @@ class StackUpdate(object):
current_res.update_template_diff_properties(updated_props,
current_props)
updated_keys.append(key)
except resource.UpdateReplace:
except exception.UpdateReplace:
replaced_keys.append(key)
return {

@ -156,7 +156,7 @@ class WorkerService(service.Service):
check_resource_update(rsrc, tmpl.id, resource_data,
self.engine_id,
stack.time_remaining())
except resource.UpdateReplace:
except exception.UpdateReplace:
new_res_id = rsrc.make_replacement(tmpl.id)
LOG.info("Replacing resource with new id %s", new_res_id)
rpc_data = sync_point.serialize_input_data(resource_data)

@ -1118,7 +1118,7 @@ class InstancesTest(common.HeatTestCase):
update_template = copy.deepcopy(instance.t)
update_template['Properties']['ImageId'] = 'mustreplace'
updater = scheduler.TaskRunner(instance.update, update_template)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
self.m.VerifyAll()

@ -23,7 +23,6 @@ from heat.common import exception
from heat.common import template_format
from heat.engine.clients.os import ceilometer
from heat.engine import properties as props
from heat.engine import resource
from heat.engine.resources.openstack.ceilometer import alarm
from heat.engine import rsrc_defn
from heat.engine import scheduler
@ -293,7 +292,7 @@ class CeilometerAlarmTest(common.HeatTestCase):
properties)
updater = scheduler.TaskRunner(rsrc.update, snippet)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
self.m.VerifyAll()

@ -167,7 +167,7 @@ class CheckWorkflowUpdateTest(common.HeatTestCase):
@mock.patch.object(resource.Resource, 'make_replacement')
def test_is_update_traversal_raise_update_replace(
self, mock_mr, mock_cru, mock_crc, mock_pcr, mock_csc, mock_cid):
mock_cru.side_effect = resource.UpdateReplace
mock_cru.side_effect = exception.UpdateReplace
self.worker.check_resource(
self.ctx, self.resource.id, self.stack.current_traversal, {},
self.is_update, None)

@ -16,7 +16,6 @@ import six
from heat.common import exception
from heat.common import template_format
from heat.engine import resource
from heat.engine import resources
from heat.engine.resources.openstack.manila import security_service
from heat.engine import scheduler
@ -166,7 +165,7 @@ class ManilaSecurityServiceTest(common.HeatTestCase):
rsrc_defns = template.Template(t).resource_definitions(self.stack)
new_ss = rsrc_defns['security_service']
self.assertEqual(0, self.client.security_services.update.call_count)
err = self.assertRaises(resource.UpdateReplace,
err = self.assertRaises(exception.UpdateReplace,
scheduler.TaskRunner(ss.update, new_ss))
msg = 'The Resource security_service requires replacement.'
self.assertEqual(msg, six.text_type(err))

@ -309,7 +309,7 @@ class TestMistralWorkflow(common.HeatTestCase):
self.mistral.workflows.update.return_value = new_workflows
self.mistral.workflows.delete.return_value = None
err = self.assertRaises(resource.UpdateReplace,
err = self.assertRaises(exception.UpdateReplace,
scheduler.TaskRunner(wf.update,
new_workflow))
msg = 'The Resource workflow requires replacement.'

@ -19,7 +19,6 @@ from neutronclient.v2_0 import client as neutronclient
from heat.common import exception
from heat.common import template_format
from heat.engine import resource
from heat.engine import rsrc_defn
from heat.engine import scheduler
from heat.tests import common
@ -492,7 +491,7 @@ class NeutronPortTest(common.HeatTestCase):
new_props['replacement_policy'] = 'REPLACE_ALWAYS'
update_snippet = rsrc_defn.ResourceDefinition(port.name, port.type(),
new_props)
self.assertRaises(resource.UpdateReplace, port._needs_update,
self.assertRaises(exception.UpdateReplace, port._needs_update,
update_snippet, port.frozen_definition(),
new_props, props, None)

@ -1742,7 +1742,7 @@ class ServersTest(common.HeatTestCase):
update_template = copy.deepcopy(server.t)
update_template['Properties']['flavor'] = 'm1.small'
updater = scheduler.TaskRunner(server.update, update_template)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
def test_server_update_server_flavor_policy_update(self):
stack_name = 'update_flvpol'
@ -1763,7 +1763,7 @@ class ServersTest(common.HeatTestCase):
update_template['Properties']['flavor_update_policy'] = 'REPLACE'
update_template['Properties']['flavor'] = 'm1.small'
updater = scheduler.TaskRunner(server.update, update_template)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
def test_server_update_image_replace(self):
stack_name = 'update_imgrep'
@ -1784,7 +1784,7 @@ class ServersTest(common.HeatTestCase):
update_template = copy.deepcopy(server.t)
update_template['Properties']['image'] = image_id
updater = scheduler.TaskRunner(server.update, update_template)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
def _test_server_update_image_rebuild(self, status, policy='REBUILD',
password=None):
@ -1914,7 +1914,7 @@ class ServersTest(common.HeatTestCase):
update_template['Properties']['image'] = 'mustreplace'
update_template['Properties']['image_update_policy'] = 'REPLACE'
updater = scheduler.TaskRunner(server.update, update_template)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
def test_server_status_build(self):
return_server = self.fc.servers.list()[0]
@ -3353,7 +3353,7 @@ class ServersTest(common.HeatTestCase):
# update
updater = scheduler.TaskRunner(server.update, update_template)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
self.m.VerifyAll()

@ -13,6 +13,7 @@
import mock
from heat.common import exception
from heat.engine.clients.os import monasca as client_plugin
from heat.engine import resource
from heat.engine.resources.openstack.monasca import alarm_definition
@ -219,7 +220,7 @@ class MonascaAlarmDefinitionTest(common.HeatTestCase):
prop_diff = {alarm_definition.MonascaAlarmDefinition.EXPRESSION:
'expression-updated'}
self.assertRaises(resource.UpdateReplace,
self.assertRaises(exception.UpdateReplace,
self.test_resource.handle_update,
json_snippet=None,
tmpl_diff=None,

@ -18,11 +18,11 @@ from oslo_serialization import jsonutils as json
from oslo_utils import timeutils
import six
from heat.common import exception
from heat.common import identifier
from heat.common import template_format
from heat.engine.clients.os import heat_plugin
from heat.engine import environment
from heat.engine import resource
from heat.engine.resources.openstack.heat import wait_condition_handle as h_wch
from heat.engine import stack as parser
from heat.engine import template as tmpl
@ -360,4 +360,4 @@ class HeatWaitConditionTest(common.HeatTestCase):
handle = self.stack['update_wait_handle']
self.assertEqual((handle.CREATE, handle.COMPLETE), handle.state)
self.assertRaises(
resource.UpdateReplace, handle.update, None, None)
exception.UpdateReplace, handle.update, None, None)

@ -14,8 +14,8 @@
import copy
from heat.common import exception
from heat.common import template_format
from heat.engine import resource
from heat.engine.resources.openstack.heat import cloud_watch
from heat.engine import rsrc_defn
from heat.engine import scheduler
@ -125,7 +125,7 @@ class CloudWatchAlarmTest(common.HeatTestCase):
props)
updater = scheduler.TaskRunner(rsrc.update, snippet)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
scheduler.TaskRunner(rsrc.delete)()
self.m.VerifyAll()

@ -24,7 +24,6 @@ from heat.engine.hot import functions as hot_functions
from heat.engine.hot import parameters as hot_param
from heat.engine.hot import template as hot_template
from heat.engine import parameters
from heat.engine import resource
from heat.engine import resources
from heat.engine import rsrc_defn
from heat.engine import stack as parser
@ -1183,7 +1182,7 @@ class HotStackTest(common.HeatTestCase):
'Properties': {'Foo': 'xyz'}},
{'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}
).WithSideEffects(check_props).AndRaise(resource.UpdateReplace)
).WithSideEffects(check_props).AndRaise(exception.UpdateReplace)
self.m.ReplayAll()
self.stack.update(updated_stack)
@ -1227,7 +1226,7 @@ class HotStackTest(common.HeatTestCase):
'Properties': {'Foo': 'xyz'}},
{'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}
).WithSideEffects(check_props).AndRaise(resource.UpdateReplace)
).WithSideEffects(check_props).AndRaise(exception.UpdateReplace)
self.m.ReplayAll()
self.stack.update(updated_stack)

@ -19,7 +19,6 @@ import six
from heat.common import exception
from heat.common import grouputils
from heat.common import template_format
from heat.engine import resource
from heat.engine.resources.openstack.heat import instance_group as instgrp
from heat.engine import rsrc_defn
from heat.engine import scheduler
@ -196,7 +195,7 @@ class TestLaunchConfig(common.HeatTestCase):
metadata)
# Changing metadata in the second update triggers UpdateReplace
updater = scheduler.TaskRunner(rsrc.update, update_snippet)
self.assertRaises(resource.UpdateReplace, updater)
self.assertRaises(exception.UpdateReplace, updater)
class LoadbalancerReloadTest(common.HeatTestCase):

@ -24,7 +24,6 @@ from heat.common import exception
from heat.common.i18n import _
from heat.common import template_format
from heat.engine import environment
from heat.engine import resource
from heat.engine.resources.openstack.heat import remote_stack
from heat.engine import rsrc_defn
from heat.engine import scheduler
@ -619,7 +618,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
update_snippet = rsrc_defn.ResourceDefinition(rsrc.name,
rsrc.type(),
props)
self.assertRaises(resource.UpdateReplace,
self.assertRaises(exception.UpdateReplace,
scheduler.TaskRunner(rsrc.update, update_snippet))
def test_update_failed(self):

@ -371,7 +371,7 @@ class ResourceTest(common.HeatTestCase):
utmpl = rsrc_defn.ResourceDefinition('test_resource', 'TestResource',
{'a_string': 'foo'})
self.assertRaises(
resource.UpdateReplace, scheduler.TaskRunner(res.update, utmpl))
exception.UpdateReplace, scheduler.TaskRunner(res.update, utmpl))
def test_update_replace_in_failed_without_nested(self):
tmpl = rsrc_defn.ResourceDefinition('test_resource',
@ -394,7 +394,7 @@ class ResourceTest(common.HeatTestCase):
# resource in failed status and hasn't nested will enter
# UpdateReplace flow
self.assertRaises(
resource.UpdateReplace, scheduler.TaskRunner(res.update, utmpl))
exception.UpdateReplace, scheduler.TaskRunner(res.update, utmpl))
self.m.VerifyAll()
@ -586,7 +586,7 @@ class ResourceTest(common.HeatTestCase):
after_props = {'Bar': '456'}
res = generic_rsrc.ResourceWithProps('test_resource', tmpl, self.stack)
res.update_allowed_properties = ('Cat',)
self.assertRaises(resource.UpdateReplace,
self.assertRaises(exception.UpdateReplace,
res.update_template_diff_properties,
after_props, before_props)
@ -859,12 +859,12 @@ class ResourceTest(common.HeatTestCase):
tmpl_diff = {'Properties': {'Foo': 'xyz'}}
prop_diff = {'Foo': 'xyz'}
generic_rsrc.ResourceWithProps.handle_update(
utmpl, tmpl_diff, prop_diff).AndRaise(resource.UpdateReplace(
utmpl, tmpl_diff, prop_diff).AndRaise(exception.UpdateReplace(
res.name))
self.m.ReplayAll()
# should be re-raised so parser.Stack can handle replacement
updater = scheduler.TaskRunner(res.update, utmpl)
ex = self.assertRaises(resource.UpdateReplace, updater)
ex = self.assertRaises(exception.UpdateReplace, updater)
self.assertEqual('The Resource test_resource requires replacement.',
six.text_type(ex))
self.m.VerifyAll()
@ -885,11 +885,11 @@ class ResourceTest(common.HeatTestCase):
tmpl_diff = {'Properties': {'Foo': 'xyz'}}
prop_diff = {'Foo': 'xyz'}
generic_rsrc.ResourceWithProps.handle_update(
utmpl, tmpl_diff, prop_diff).AndRaise(resource.UpdateReplace())
utmpl, tmpl_diff, prop_diff).AndRaise(exception.UpdateReplace())
self.m.ReplayAll()
# should be re-raised so parser.Stack can handle replacement
updater = scheduler.TaskRunner(res.update, utmpl)
ex = self.assertRaises(resource.UpdateReplace, updater)
ex = self.assertRaises(exception.UpdateReplace, updater)
self.assertEqual('The Resource Unknown requires replacement.',
six.text_type(ex))
self.m.VerifyAll()
@ -903,7 +903,7 @@ class ResourceTest(common.HeatTestCase):
self.assertEqual((res.INIT, res.COMPLETE), res.state)
prop = {'Foo': 'abc'}
self.assertRaises(resource.UpdateReplace,
self.assertRaises(exception.UpdateReplace,
res._needs_update, tmpl, tmpl, prop, prop, res)
def test_update_fail_missing_req_prop(self):

@ -543,7 +543,7 @@ class StackResourceTest(StackResourceBaseTest):
self.parent_resource.state_set(self.parent_resource.INIT,
self.parent_resource.FAILED)
self.parent_resource._nested = None
self.assertRaises(resource.UpdateReplace,
self.assertRaises(exception.UpdateReplace,
self.parent_resource._needs_update,
self.parent_resource.t,
self.parent_resource.t,
@ -559,7 +559,7 @@ class StackResourceTest(StackResourceBaseTest):
self.parent_resource.state_set(self.parent_resource.INIT,
self.parent_resource.COMPLETE)
self.parent_resource._nested = None
self.assertRaises(resource.UpdateReplace,
self.assertRaises(exception.UpdateReplace,
self.parent_resource._needs_update,
self.parent_resource.t,
self.parent_resource.t,

@ -15,6 +15,7 @@ import copy
import mock
from heat.common import exception
from heat.common import template_format
from heat.engine import environment
from heat.engine import resource
@ -340,7 +341,7 @@ class StackUpdateTest(common.HeatTestCase):
def check_and_raise(*args):
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
raise resource.UpdateReplace
raise exception.UpdateReplace
mock_upd = self.patchobject(generic_rsrc.ResourceWithProps,
'update_template_diff',

@ -16,7 +16,6 @@ import six
from heat.common import exception
from heat.common import template_format
from heat.engine import resource
from heat.engine.resources.openstack.zaqar import queue
from heat.engine import rsrc_defn
from heat.engine import scheduler
@ -261,7 +260,7 @@ class ZaqarMessageQueueTest(common.HeatTestCase):
new_queue = resource_defns['MyQueue2']
scheduler.TaskRunner(queue.create)()
err = self.assertRaises(resource.UpdateReplace,
err = self.assertRaises(exception.UpdateReplace,
scheduler.TaskRunner(queue.update,
new_queue))
msg = 'The Resource MyQueue2 requires replacement.'

Loading…
Cancel
Save