Merge "Remove update abort"

This commit is contained in:
Jenkins 2017-05-04 17:30:11 +00:00 committed by Gerrit Code Review
commit 1ec72b5d10
7 changed files with 13 additions and 98 deletions

View File

@ -0,0 +1,8 @@
---
fixes:
- The update abort command was introduced many releases ago. However, it is
not a safe operation in the context of TripleO. The TripleO Heat stack
could become irrepairably damage should a rollback be attempted. As such,
it is best to remove this functionality without a deprecation period.
The workaround for this command is to wait until the stack times out or
completes the update.

View File

@ -77,7 +77,6 @@ mistral.actions =
tripleo.heat_capabilities.get = tripleo_common.actions.heat_capabilities:GetCapabilitiesAction
tripleo.heat_capabilities.update = tripleo_common.actions.heat_capabilities:UpdateCapabilitiesAction
tripleo.package_update.clear_breakpoints = tripleo_common.actions.package_update:ClearBreakpointsAction
tripleo.package_update.cancel_stack_update = tripleo_common.actions.package_update:CancelStackUpdateAction
tripleo.package_update.update_stack = tripleo_common.actions.package_update:UpdateStackAction
tripleo.parameters.get = tripleo_common.actions.parameters:GetParametersAction
tripleo.parameters.reset = tripleo_common.actions.parameters:ResetParametersAction

View File

@ -79,13 +79,6 @@ class StackUpdateManager(object):
LOG.debug('%s status: %s', self.stack.stack_name, status)
return (status, resources)
def cancel(self):
LOG.info("canceling update")
self.heatclient.actions.cancel_update(self.stack.id)
# removing existing breakpoints
resources = self._resources_by_state()
self.clear_breakpoints(resources['on_breakpoint'].keys())
def do_interactive_update(self):
status, _ = self.get_status()
@ -105,16 +98,12 @@ class StackUpdateManager(object):
user_input = six.moves.input(
"Breakpoint reached, continue? Regexp or "
"Enter=proceed (will clear %s), "
"no=cancel update, C-c=quit interactive mode: "
"C-c=quit interactive mode: "
% resources['on_breakpoint'].keys()[-1])
if user_input.strip().lower() == 'no':
print("canceling update, doing rollback")
self.cancel()
else:
refs = self._input_to_refs(
user_input.strip(),
resources['on_breakpoint'].keys())
self.clear_breakpoints(refs)
refs = self._input_to_refs(
user_input.strip(),
resources['on_breakpoint'].keys())
self.clear_breakpoints(refs)
time.sleep(5)
print('update finished with status {0}'.format(status))

View File

@ -41,19 +41,6 @@ class ClearBreakpointsAction(base.TripleOAction):
update_manager.clear_breakpoints(self.refs)
class CancelStackUpdateAction(base.TripleOAction):
def __init__(self, stack_id):
super(CancelStackUpdateAction, self).__init__()
self.stack_id = stack_id
def run(self):
heat = self.get_orchestration_client()
nova = self.get_compute_client()
update_manager = PackageUpdateManager(
heat, nova, self.stack_id, stack_fields={})
update_manager.cancel()
class UpdateStackAction(templates.ProcessTemplatesAction):
def __init__(self, timeout, container=constants.DEFAULT_CONTAINER_NAME):

View File

@ -48,33 +48,6 @@ class ClearBreakpointsActionTest(base.TestCase):
self.refs)
class CancelStackUpdateActionTest(base.TestCase):
def setUp(self,):
super(CancelStackUpdateActionTest, self).setUp()
self.stack_id = 'stack_id'
@mock.patch('tripleo_common.actions.package_update.PackageUpdateManager')
@mock.patch('tripleo_common.actions.base.TripleOAction.'
'get_orchestration_client')
@mock.patch('tripleo_common.actions.base.TripleOAction.'
'get_compute_client')
def test_run(self, mock_compute_client,
mock_orchestration_client,
mock_update_manager):
action = package_update.CancelStackUpdateAction(self.stack_id)
result = action.run()
self.assertEqual(None, result)
mock_compute_client.assert_called_once()
mock_orchestration_client.assert_called_once()
mock_update_manager.assert_called_once_with(
mock_orchestration_client(),
mock_compute_client(),
self.stack_id,
stack_fields={})
mock_update_manager().cancel.assert_called_once()
class UpdateStackActionTest(base.TestCase):
def setUp(self,):

View File

@ -90,14 +90,6 @@ class StackUpdateManagerTest(base.TestCase):
self.assertEqual(good, [])
self.assertEqual(bad, ['resource_id'])
def test_cancel(self):
self.stack_update_manager.cancel()
self.heatclient.actions.cancel_update.assert_called_once_with('123')
self.heatclient.resources.signal.assert_called_once_with(
stack_id='123',
resource_name='logical_id',
data={'unset_hook': 'pre-update'})
def test_intput_to_refs_regexp(self):
result = self.stack_update_manager._input_to_refs(
'instance_name.*', ['instance_id'])

View File

@ -74,36 +74,3 @@ workflows:
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
cancel_stack_update:
description: Cancel a currently running stack update
input:
- stack_id
- queue_name: tripleo
tasks:
cancel_stack_update:
action: tripleo.package_update.cancel_stack_update stack_id=<% $.stack_id %>
on-success: send_message
on-error: set_cancel_stack_update_failed
set_cancel_stack_update_failed:
on-success: send_message
publish:
status: FAILED
message: <% task(cancel_stack_update).result %>
send_message:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.package_update.v1.cancel_stack_update
payload:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>