Make SoftwareDeployments work for non-CREATE actions
Currently we only create the deployment if the actions list includes
CREATE, but its valid to create e.g DELETE only deployments, which
curently won't work. So determine whether to create the deployment
on the resource_id instead of via the action, which resolves this problem.
Change-Id: Ia563f4130c31baa4dcee3be3786ea3c49b6bad98
Closes-Bug: #1444087
(cherry picked from commit 0d42350150)
This commit is contained in:
committed by
Doug Hellmann
parent
d56778dc7a
commit
e2b89e2d58
@@ -239,15 +239,13 @@ class SoftwareDeployment(signal_responder.SignalResponder):
|
||||
self._get_derived_config(action, config),
|
||||
action)
|
||||
|
||||
if action == self.CREATE:
|
||||
if self.resource_id is None:
|
||||
sd = self.rpc_client().create_software_deployment(
|
||||
self.context,
|
||||
server_id=self.properties[SoftwareDeployment.SERVER],
|
||||
stack_user_project_id=self.stack.stack_user_project_id,
|
||||
**props)
|
||||
self.resource_id_set(sd[rpc_api.SOFTWARE_DEPLOYMENT_ID])
|
||||
elif self.resource_id is None:
|
||||
sd = None
|
||||
else:
|
||||
sd = self.rpc_client().show_software_deployment(
|
||||
self.context, self.resource_id)
|
||||
|
||||
@@ -596,7 +596,8 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
||||
def test_handle_delete_resource_id_is_None(self):
|
||||
self._create_stack(self.template_delete_suspend_resume)
|
||||
self.mock_software_config()
|
||||
self.assertIsNone(self.deployment.handle_delete())
|
||||
sd = self.mock_deployment()
|
||||
self.assertEqual(sd, self.deployment.handle_delete())
|
||||
|
||||
def test_delete_complete(self):
|
||||
self._create_stack(self.template_delete_suspend_resume)
|
||||
|
||||
Reference in New Issue
Block a user