def handle_create(self):
templ = template_format.parse(mysql_template)
- self.create_with_template(templ, self._params())
+ return self.create_with_template(templ, self._params())
def handle_delete(self):
self.delete_nested()
# total hack - probably need an admin key here.
param = self.stack.resolve_static_data({'KeyName': {'Ref': 'KeyName'}})
- self.create_with_template(templ, param)
+ return self.create_with_template(templ, param)
def handle_delete(self):
self.delete_nested()
template_data = urlfetch.get(self.properties[PROP_TEMPLATE_URL])
template = template_format.parse(template_data)
- self.create_with_template(template,
- self.properties[PROP_PARAMETERS],
- self.properties[PROP_TIMEOUT_MINS])
+ return self.create_with_template(template,
+ self.properties[PROP_PARAMETERS],
+ self.properties[PROP_TIMEOUT_MINS])
def handle_delete(self):
self.delete_nested()
from heat.common import exception
from heat.engine import resource
from heat.engine import parser
+from heat.engine import scheduler
from heat.openstack.common import log as logging
nested_id = self._nested.store(self.stack)
self.resource_id_set(nested_id)
- self._nested.create()
- if self._nested.state != self._nested.CREATE_COMPLETE:
- raise exception.Error(self._nested.state_description)
+
+ stack_creator = scheduler.TaskRunner(self._nested.create_task)
+ stack_creator.start(timeout=self._nested.timeout_secs())
+ return stack_creator
+
+ def check_create_complete(self, stack_creator):
+ done = stack_creator.step()
+ if done:
+ if self._nested.state != self._nested.CREATE_COMPLETE:
+ raise exception.Error(self._nested.state_description)
+
+ return done
def delete_nested(self):
'''
super(DBInstanceTest, self).setUp()
setup_dummy_db()
self.m.StubOutWithMock(dbi.DBInstance, 'create_with_template')
+ self.m.StubOutWithMock(dbi.DBInstance, 'check_create_complete')
self.m.StubOutWithMock(dbi.DBInstance, 'nested')
def create_dbinstance(self, t, stack, resource_name):
dbi.DBInstance.create_with_template(mox.IgnoreArg(),
params).AndReturn(None)
+ dbi.DBInstance.check_create_complete(mox.IgnoreArg()).AndReturn(True)
fn = FakeNested()
def create_stack(self, template):
t = template_format.parse(template)
stack = self.parse_stack(t)
- self.assertEqual(None, stack.create())
+ stack.create()
+ self.assertEqual(stack.state, stack.CREATE_COMPLETE)
return stack
def parse_stack(self, t):