Merge "OSC add capability to remove node/chassis_uuid"

This commit is contained in:
Jenkins 2016-11-14 19:17:36 +00:00 committed by Gerrit Code Review
commit b1c6a6c40f
4 changed files with 34 additions and 1 deletions

View File

@ -25,7 +25,7 @@ LOG = logging.getLogger(__name__)
API_VERSION_OPTION = 'os_baremetal_api_version'
API_NAME = 'baremetal'
LAST_KNOWN_API_VERSION = 22
LAST_KNOWN_API_VERSION = 25
API_VERSIONS = {
'1.%d' % i: 'ironicclient.v1.client.Client'
for i in range(1, LAST_KNOWN_API_VERSION + 1)

View File

@ -1038,6 +1038,12 @@ class UnsetBaremetalNode(command.Command):
help='Instance information to unset on this baremetal node '
'(repeat option to unset multiple instance informations)',
)
parser.add_argument(
"--chassis-uuid",
dest='chassis_uuid',
action='store_true',
help=_('Unset chassis UUID on this baremetal node'),
)
return parser
@ -1077,6 +1083,9 @@ class UnsetBaremetalNode(command.Command):
properties.extend(utils.args_array_to_patch('remove',
['instance_info/' + x for x
in parsed_args.instance_info]))
if parsed_args.chassis_uuid:
properties.extend(utils.args_array_to_patch('remove',
['chassis_uuid']))
if properties:
baremetal_client.node.update(parsed_args.node, properties)

View File

@ -1651,6 +1651,25 @@ class TestBaremetalUnset(TestBaremetal):
[{'path': '/name', 'op': 'remove'}]
)
def test_baremetal_unset_chassis_uuid(self):
arglist = [
'node_uuid',
'--chassis-uuid',
]
verifylist = [
('node', 'node_uuid'),
('chassis_uuid', True)
]
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', 'op': 'remove'}]
)
class TestValidate(TestBaremetal):
def setUp(self):

View File

@ -0,0 +1,5 @@
---
features:
- Add possibility to remove chassis_uuid for node by adding
'--chassis-uuid' argument to 'openstack baremetal node unset'
command.