Adds --driver option to OSC "node list" command

For the OSC command ``openstack baremetal node list``, adds the
``--driver <driver>`` option to limit the list to nodes with the
specified driver.

Change-Id: Id5d17bc393df25b1d6f83621f6f4eb9f9c4ac746
Closes-Bug: #1696871
This commit is contained in:
Ruby Loo 2017-06-08 18:23:39 -04:00
parent 725b45376a
commit 3067d93a4e
3 changed files with 37 additions and 0 deletions

View File

@ -566,6 +566,11 @@ class ListBaremetalNode(command.Lister):
dest='provision_state',
metavar='<provision state>',
help=_("List nodes in specified provision state."))
parser.add_argument(
'--driver',
dest='driver',
metavar='<driver>',
help=_("Limit list to nodes with driver <driver>"))
parser.add_argument(
'--resource-class',
dest='resource_class',
@ -617,6 +622,8 @@ class ListBaremetalNode(command.Lister):
params['maintenance'] = parsed_args.maintenance
if parsed_args.provision_state:
params['provision_state'] = parsed_args.provision_state
if parsed_args.driver:
params['driver'] = parsed_args.driver
if parsed_args.resource_class:
params['resource_class'] = parsed_args.resource_class
if parsed_args.chassis:

View File

@ -779,6 +779,30 @@ class TestBaremetalList(TestBaremetal):
**kwargs
)
def test_baremetal_list_driver(self):
arglist = [
'--driver', 'ipmi',
]
verifylist = [
('driver', 'ipmi'),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
kwargs = {
'marker': None,
'limit': None,
'driver': 'ipmi'
}
self.baremetal_mock.node.list.assert_called_with(
**kwargs
)
def test_baremetal_list_resource_class(self):
arglist = [
'--resource-class', 'foo',

View File

@ -0,0 +1,6 @@
---
features:
- |
For the OSC command ``openstack baremetal node list``, adds the
``--driver <driver>`` option to limit the list to nodes with the
specified driver.