Merge "Adds --chassis-uuid to osc 'baremetal node set'"

This commit is contained in:
Jenkins 2016-11-15 16:02:13 +00:00 committed by Gerrit Code Review
commit fc9192b280
3 changed files with 33 additions and 0 deletions

View File

@ -785,6 +785,11 @@ class SetBaremetalNode(command.Command):
metavar="<name>",
help="Set the name of the node",
)
parser.add_argument(
"--chassis-uuid",
metavar="<chassis UUID>",
help="Set the chassis for the node",
)
parser.add_argument(
"--driver",
metavar="<driver>",
@ -864,6 +869,10 @@ class SetBaremetalNode(command.Command):
name = ["name=%s" % parsed_args.name]
properties.extend(utils.args_array_to_patch(
'add', name))
if parsed_args.chassis_uuid:
chassis_uuid = ["chassis_uuid=%s" % parsed_args.chassis_uuid]
properties.extend(utils.args_array_to_patch(
'add', chassis_uuid))
if parsed_args.driver:
driver = ["driver=%s" % parsed_args.driver]
properties.extend(utils.args_array_to_patch(

View File

@ -1085,6 +1085,26 @@ class TestBaremetalSet(TestBaremetal):
[{'path': '/name', 'value': 'xxxxx', 'op': 'add'}]
)
def test_baremetal_set_chassis(self):
chassis = '4f4135ea-7e58-4e3d-bcc4-b87ca16e980b'
arglist = [
'node_uuid',
'--chassis-uuid', chassis,
]
verifylist = [
('node', 'node_uuid'),
('chassis_uuid', chassis)
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.baremetal_mock.node.update.assert_called_once_with(
'node_uuid',
[{'path': '/chassis_uuid', 'value': chassis, 'op': 'add'}]
)
def test_baremetal_set_driver(self):
arglist = [
'node_uuid',

View File

@ -0,0 +1,4 @@
---
features:
- The chassis of a node can be set via the new --chassis-uuid
optional argument for ``openstack baremetal node set``.