From 2a2a6e17817a8482770e2be9d3604b9cd45b46f8 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 29 May 2023 16:38:44 +0100 Subject: [PATCH] trivial: Make better use of argparse Change-Id: Ib76c0d18bf5e44bfb4dcd9d729d9a1c5635cdba7 Signed-off-by: Stephen Finucane --- openstackclient/tests/unit/volume/v2/test_volume_type.py | 1 + openstackclient/volume/v2/volume_type.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openstackclient/tests/unit/volume/v2/test_volume_type.py b/openstackclient/tests/unit/volume/v2/test_volume_type.py index 2157eabccd..ca6971e536 100644 --- a/openstackclient/tests/unit/volume/v2/test_volume_type.py +++ b/openstackclient/tests/unit/volume/v2/test_volume_type.py @@ -173,6 +173,7 @@ class TestTypeCreate(TestType): self.new_volume_type.name, ] verifylist = [ + ('is_public', None), ('project', self.project.id), ('name', self.new_volume_type.name), ] diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py index ebb364b5d8..f865c8247c 100644 --- a/openstackclient/volume/v2/volume_type.py +++ b/openstackclient/volume/v2/volume_type.py @@ -250,11 +250,14 @@ class CreateVolumeType(command.ShowOne): raise exceptions.CommandError(msg) kwargs = {} + if parsed_args.is_public is not None: kwargs['is_public'] = parsed_args.is_public volume_type = volume_client.volume_types.create( - parsed_args.name, description=parsed_args.description, **kwargs + parsed_args.name, + description=parsed_args.description, + **kwargs, ) volume_type._info.pop('extra_specs')