Merge "Include parameters info in stack-abandon data"

This commit is contained in:
Jenkins 2014-10-01 16:45:58 +00:00 committed by Gerrit Code Review
commit bd71400191
4 changed files with 13 additions and 6 deletions

View File

@ -1079,6 +1079,7 @@ class Stack(collections.Mapping):
'name': self.name,
'id': self.id,
'action': self.action,
'environment': self.env.user_env_as_dict(),
'status': self.status,
'template': self.t.t,
'resources': dict((res.name, res.prepare_abandon())

View File

@ -2039,7 +2039,7 @@ class StackServiceTest(HeatTestCase):
'type': u'AWS::EC2::Instance'}}
self.m.ReplayAll()
ret = self.eng.abandon_stack(self.ctx, self.stack.identifier())
self.assertEqual(8, len(ret))
self.assertEqual(9, len(ret))
self.assertEqual('CREATE', ret['action'])
self.assertEqual('COMPLETE', ret['status'])
self.assertEqual('service_abandon_stack', ret['name'])
@ -2048,6 +2048,7 @@ class StackServiceTest(HeatTestCase):
self.assertEqual(self.stack.t.t, ret['template'])
self.assertIn('project_id', ret)
self.assertIn('stack_user_project_id', ret)
self.assertIn('environment', ret)
self.m.VerifyAll()
self.eng.thread_group_mgr.groups[self.stack.id].wait()

View File

@ -1107,11 +1107,11 @@ class StackTest(HeatTestCase):
self.stack, self.stack['A'].nested().root_stack)
keys = ['name', 'id', 'action', 'status', 'template', 'resources',
'project_id', 'stack_user_project_id']
'project_id', 'stack_user_project_id', 'environment']
self.assertEqual(8, len(ret))
self.assertEqual(len(keys), len(ret))
nested_stack_data = ret['resources']['A']
self.assertEqual(8, len(nested_stack_data))
self.assertEqual(len(keys), len(nested_stack_data))
for key in keys:
self.assertIn(key, ret)
self.assertIn(key, nested_stack_data)
@ -1163,6 +1163,7 @@ class StackTest(HeatTestCase):
def test_get_stack_abandon_data(self):
tpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Parameters': {'param1': {'Type': 'String'}},
'Resources':
{'A': {'Type': 'GenericResourceType'},
'B': {'Type': 'GenericResourceType'}}}
@ -1172,10 +1173,12 @@ class StackTest(HeatTestCase):
"B": {"status": "COMPLETE", "name": "B", "resource_data": {},
"resource_id": null, "action": "INIT", "type": "GenericResourceType",
"metadata": {}}}'''
env = environment.Environment({'parameters': {'param1': 'test'}})
self.stack = parser.Stack(self.ctx, 'stack_details_test',
parser.Template(tpl),
tenant_id='123',
stack_user_project_id='234')
stack_user_project_id='234',
env=env)
self.stack.store()
info = self.stack.prepare_abandon()
self.assertEqual('CREATE', info['action'])
@ -1186,6 +1189,7 @@ class StackTest(HeatTestCase):
self.assertEqual(tpl, info['template'])
self.assertEqual('123', info['project_id'])
self.assertEqual('234', info['stack_user_project_id'])
self.assertEqual(env.params, info['environment']['parameters'])
def test_set_param_id(self):
self.stack = parser.Stack(self.ctx, 'param_arn_test',

View File

@ -324,7 +324,7 @@ class StackResourceTest(HeatTestCase):
# check abandoned data contains all the necessary information.
# (no need to check stack/resource IDs, because they are
# randomly generated uuids)
self.assertEqual(8, len(ret))
self.assertEqual(9, len(ret))
self.assertEqual('CREATE', ret['action'])
self.assertIn('name', ret)
self.assertIn('id', ret)
@ -333,6 +333,7 @@ class StackResourceTest(HeatTestCase):
ret['template'])
self.assertIn('stack_user_project_id', ret)
self.assertIn('project_id', ret)
self.assertIn('environment', ret)
def test_create_with_template_validates(self):
"""