Default the stack name to 'overcloud' in overcloud node delete

The stack needs to be passed as either a CLI arg with --stack or via the
environment variable OVERCLOUD_STACK_NAME. At the moment if it isn't
provided either way the workflow is called with an empty string for the
stack name. This will then fail.

This change defaults the stack name to 'overcloud' which matches the
deploy command. One of the unit tests was updated so that it didn't pass
the default value to ensure that it can still be overwritten.

Change-Id: Ie44d5cba90e81ae1a35a4cabc6e20a202bfddef0
Closes-Bug: #1640244
Partial-Bug: #1640770
(cherry picked from commit 0af664656d)
This commit is contained in:
Dougal Matthews 2016-11-09 10:49:47 +00:00 committed by Julie Pichon
parent 722f6629b9
commit 2ed71e8e85
2 changed files with 30 additions and 4 deletions

View File

@ -54,9 +54,9 @@ class TestDeleteNode(fakes.TestDeleteNode):
# probably be fixed so that it can pass with that.
def test_node_delete(self):
argslist = ['instance1', 'instance2', '--templates',
'--stack', 'overcloud']
'--stack', 'overcast']
verifylist = [
('stack', 'overcloud'),
('stack', 'overcast'),
('nodes', ['instance1', 'instance2'])
]
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
@ -71,11 +71,36 @@ class TestDeleteNode(fakes.TestDeleteNode):
self.workflow.executions.create.assert_called_once_with(
'tripleo.scale.v1.delete_node',
workflow_input={
'container': 'overcloud',
'container': 'overcast',
'queue_name': 'UUID4',
'nodes': ['instance1', 'instance2']
})
def test_node_delete_without_stack(self):
arglist = ['instance1', ]
verifylist = [
('stack', 'overcloud'),
('nodes', ['instance1']),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.websocket.wait_for_message.return_value = {
"status": "SUCCESS"
}
self.cmd.take_action(parsed_args)
# Verify
self.workflow.executions.create.assert_called_once_with(
'tripleo.scale.v1.delete_node',
workflow_input={
'container': 'overcloud',
'queue_name': 'UUID4',
'nodes': ['instance1', ]
})
class TestProvideNode(fakes.TestOvercloudNode):

View File

@ -39,7 +39,8 @@ class DeleteNode(command.Command):
parser.add_argument('--stack', dest='stack',
help=_('Name or ID of heat stack to scale '
'(default=Env: OVERCLOUD_STACK_NAME)'),
default=utils.env('OVERCLOUD_STACK_NAME'))
default=utils.env('OVERCLOUD_STACK_NAME',
default='overcloud'))
parser.add_argument(
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
help=_("The directory containing the Heat templates to deploy. "