OSC add capability to remove node/chassis_uuid

Allow to unset the field chassis_uuid from a node using the
'openstack baremetal node unset --chassis-uuid <node_uuid>'
command.
Bump last known API version to 1.25

Change-Id: Ifd82bc58667d0958fc5007b3562437b34b12a620
Related-Bug: #1563263
This commit is contained in:
Vasyl Saienko 2016-10-31 14:25:33 +02:00
parent aecd5e4359
commit 4e359baf4d
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.