Skip to content

Commit 4bea5d3

Browse files
author
Huanxuan Ao
committed
Fix errors for "volume type unset" command
Normally, we can unset multi properties but the "volume type unset" command could not, because the action "append" was missed. So I add it and also fix the unit test and doc in this patch. Change-Id: I20470f2b7bb2a8d7f292cea498826669c3418c77
1 parent 93db7f5 commit 4bea5d3

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

doc/source/command-objects/volume-type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Unset volume type properties
150150
.. code:: bash
151151
152152
os volume type unset
153-
[--property <key>]
153+
[--property <key> [...] ]
154154
[--project <project>]
155155
[--project-domain <project-domain>]
156156
<volume-type>

openstackclient/tests/volume/v2/test_type.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,19 @@ def setUp(self):
397397
def test_type_unset(self):
398398
arglist = [
399399
'--property', 'property',
400+
'--property', 'multi_property',
400401
self.volume_type.id,
401402
]
402403
verifylist = [
403-
('property', 'property'),
404+
('property', ['property', 'multi_property']),
404405
('volume_type', self.volume_type.id),
405406
]
406407

407408
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
408409

409410
result = self.cmd.take_action(parsed_args)
410-
self.volume_type.unset_keys.assert_called_once_with('property')
411+
self.volume_type.unset_keys.assert_called_once_with(
412+
['property', 'multi_property'])
411413
self.assertIsNone(result)
412414

413415
def test_type_unset_project_access(self):

openstackclient/volume/v2/volume_type.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def get_parser(self, prog_name):
263263
parser.add_argument(
264264
'--property',
265265
metavar='<key>',
266+
action='append',
266267
help=_('Remove a property from this volume type '
267268
'(repeat option to remove multiple properties)'),
268269
)

0 commit comments

Comments
 (0)