Merge "Do not show chassis_uuid field when it is not specified"

This commit is contained in:
Jenkins 2017-02-03 19:24:07 +00:00 committed by Gerrit Code Review
commit 4ea6cf1181
2 changed files with 6 additions and 4 deletions

View File

@ -1113,7 +1113,8 @@ class ShowBaremetalNode(command.ShowOne):
node.pop("ports", None) node.pop("ports", None)
node.pop('portgroups', None) node.pop('portgroups', None)
node.setdefault('chassis_uuid', '') if not fields or 'chassis_uuid' in fields:
node.setdefault('chassis_uuid', '')
return self.dict2columns(node) return self.dict2columns(node)

View File

@ -2090,7 +2090,8 @@ class TestBaremetalShow(TestBaremetal):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.assertNotIn('chassis_uuid', columns)
# Set expected values # Set expected values
args = ['xxxxx'] args = ['xxxxx']
@ -2113,8 +2114,8 @@ class TestBaremetalShow(TestBaremetal):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.assertNotIn('chassis_uuid', columns)
# Set expected values # Set expected values
args = ['xxxxx'] args = ['xxxxx']
fields = ['uuid', 'name', 'extra'] fields = ['uuid', 'name', 'extra']