Merge "Remove deprecated metadata_update method"

This commit is contained in:
Jenkins 2015-06-15 14:45:30 +00:00 committed by Gerrit Code Review
commit 3b2d22c052
4 changed files with 0 additions and 110 deletions

View File

@ -1381,44 +1381,6 @@ class EngineService(service.Service):
data = snapshot_object.Snapshot.get_all(cnxt, s.id)
return [api.format_snapshot(snapshot) for snapshot in data]
@context.request_context
def metadata_update(self, cnxt, stack_identity,
resource_name, metadata):
"""
Update the metadata for the given resource.
DEPRECATED: Use resource_signal instead
"""
warnings.warn('metadata_update is deprecated, '
'use resource_signal instead',
DeprecationWarning)
s = self._get_stack(cnxt, stack_identity)
stack = parser.Stack.load(cnxt, stack=s)
if resource_name not in stack:
raise exception.ResourceNotFound(resource_name=resource_name,
stack_name=stack.name)
resource = stack[resource_name]
resource.metadata_update(new_metadata=metadata)
# This is not "nice" converting to the stored context here,
# but this happens because the keystone user associated with the
# WaitCondition doesn't have permission to read the secret key of
# the user associated with the cfn-credentials file
refresh_stack = parser.Stack.load(cnxt, stack=s,
use_stored_context=True)
# Refresh the metadata for all other resources, since we expect
# resource_name to be a WaitCondition resource, and other
# resources may refer to WaitCondition Fn::GetAtt Data, which
# is updated here.
for res in refresh_stack.dependencies:
if res.name != resource_name and res.id is not None:
res.metadata_update()
return resource.metadata_get()
@context.request_context
def create_watch_data(self, cnxt, watch_name, stats_data):
'''

View File

@ -437,15 +437,6 @@ class EngineClient(object):
return self.call(ctxt, self.make_msg('stack_cancel_update',
stack_identity=stack_identity))
def metadata_update(self, ctxt, stack_identity, resource_name, metadata):
"""
Update the metadata for the given resource.
"""
return self.call(ctxt, self.make_msg('metadata_update',
stack_identity=stack_identity,
resource_name=resource_name,
metadata=metadata))
def resource_signal(self, ctxt, stack_identity, resource_name, details,
sync_call=False):
"""

View File

@ -2580,63 +2580,6 @@ class StackServiceTest(common.HeatTestCase):
self.assertIsNone(md)
self.m.VerifyAll()
@tools.stack_context('service_metadata_test_stack')
def test_metadata(self):
test_metadata = {'foo': 'bar', 'baz': 'quux', 'blarg': 'wibble'}
pre_update_meta = self.stack['WebServer'].metadata_get()
self.m.StubOutWithMock(service.EngineService, '_get_stack')
s = stack_object.Stack.get_by_id(self.ctx, self.stack.id)
service.EngineService._get_stack(self.ctx,
self.stack.identifier()).AndReturn(s)
self.m.StubOutWithMock(instances.Instance, 'metadata_update')
instances.Instance.metadata_update(new_metadata=test_metadata)
self.m.ReplayAll()
result = self.eng.metadata_update(self.ctx,
dict(self.stack.identifier()),
'WebServer', test_metadata)
# metadata_update is a no-op for all resources except
# WaitConditionHandle so we don't expect this to have changed
self.assertEqual(pre_update_meta, result)
self.m.VerifyAll()
def test_metadata_err_stack(self):
non_exist_identifier = identifier.HeatIdentifier(
self.ctx.tenant_id, 'wibble',
'18d06e2e-44d3-4bef-9fbf-52480d604b02')
stack_not_found_exc = exception.StackNotFound(stack_name='test')
self.m.StubOutWithMock(service.EngineService, '_get_stack')
service.EngineService._get_stack(
self.ctx, non_exist_identifier).AndRaise(stack_not_found_exc)
self.m.ReplayAll()
test_metadata = {'foo': 'bar', 'baz': 'quux', 'blarg': 'wibble'}
ex = self.assertRaises(dispatcher.ExpectedException,
self.eng.metadata_update,
self.ctx, non_exist_identifier,
'WebServer', test_metadata)
self.assertEqual(exception.StackNotFound, ex.exc_info[0])
self.m.VerifyAll()
@tools.stack_context('service_metadata_err_resource_test_stack', False)
def test_metadata_err_resource(self):
self.m.StubOutWithMock(parser.Stack, 'load')
parser.Stack.load(self.ctx,
stack=mox.IgnoreArg()).AndReturn(self.stack)
self.m.ReplayAll()
test_metadata = {'foo': 'bar', 'baz': 'quux', 'blarg': 'wibble'}
ex = self.assertRaises(dispatcher.ExpectedException,
self.eng.metadata_update,
self.ctx, dict(self.stack.identifier()),
'NooServer', test_metadata)
self.assertEqual(exception.ResourceNotFound, ex.exc_info[0])
self.m.VerifyAll()
@tools.stack_context('service_show_watch_test_stack', False)
def test_show_watch(self):
# Insert two dummy watch rules into the DB

View File

@ -244,12 +244,6 @@ class EngineRpcAPITestCase(common.HeatTestCase):
self._test_engine_api('stack_cancel_update', 'call',
stack_identity=self.identity)
def test_metadata_update(self):
self._test_engine_api('metadata_update', 'call',
stack_identity=self.identity,
resource_name='LogicalResourceId',
metadata={u'wordpress': []})
def test_resource_signal(self):
self._test_engine_api('resource_signal', 'call',
stack_identity=self.identity,