Fix _show_node error
Passing the correct args to get_node function. Change-Id: I0c0c1180e1027ba5425fa9ddec1088874ddf63d9 Closes-Bug: #1616347
This commit is contained in:
parent
62bbf8491c
commit
49f18b0897
senlinclient
@ -177,14 +177,14 @@ class TestNodeShow(TestNode):
|
||||
arglist = ['my_node']
|
||||
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.mock_client.get_node.assert_called_with('my_node', args=None)
|
||||
self.mock_client.get_node.assert_called_with('my_node', details=False)
|
||||
|
||||
def test_node_show_with_details(self):
|
||||
arglist = ['my_node', '--details']
|
||||
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.mock_client.get_node.assert_called_with(
|
||||
'my_node', args={'show_details': True})
|
||||
'my_node', details=True)
|
||||
|
||||
def test_node_show_not_found(self):
|
||||
arglist = ['my_node']
|
||||
|
@ -146,9 +146,8 @@ class ShowNode(command.ShowOne):
|
||||
def _show_node(senlin_client, node_id, show_details=False):
|
||||
"""Show detailed info about the specified node."""
|
||||
|
||||
args = {'show_details': True} if show_details else None
|
||||
try:
|
||||
node = senlin_client.get_node(node_id, args=args)
|
||||
node = senlin_client.get_node(node_id, details=show_details)
|
||||
except sdk_exc.ResourceNotFound:
|
||||
raise exc.CommandError(_('Node not found: %s') % node_id)
|
||||
|
||||
@ -157,7 +156,7 @@ def _show_node(senlin_client, node_id, show_details=False):
|
||||
'data': senlin_utils.json_formatter,
|
||||
}
|
||||
data = node.to_dict()
|
||||
if show_details:
|
||||
if show_details and data['details']:
|
||||
formatters['details'] = senlin_utils.nested_dict_formatter(
|
||||
list(data['details'].keys()), ['property', 'value'])
|
||||
columns = sorted(list(six.iterkeys(data)))
|
||||
|
@ -947,7 +947,7 @@ def _show_node(service, node_id, show_details=False):
|
||||
'data': utils.json_formatter,
|
||||
}
|
||||
data = node.to_dict()
|
||||
if show_details:
|
||||
if show_details and data['details']:
|
||||
formatters['details'] = utils.nested_dict_formatter(
|
||||
list(data['details'].keys()), ['property', 'value'])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user