From 3fc585332f79358489285eabc298e01007599128 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 14 Sep 2022 13:40:17 +0100 Subject: [PATCH] volume: Volume names are optional Who knew? Change-Id: I1c1a811c0db59250e8a20a87f25c2662bc3ab3e8 Signed-off-by: Stephen Finucane --- openstackclient/tests/unit/volume/v2/test_volume.py | 4 +--- openstackclient/volume/v2/volume.py | 3 ++- releasenotes/notes/optional-volume-name-ffbefe463a598b6c.yaml | 4 ++++ 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/optional-volume-name-ffbefe463a598b6c.yaml diff --git a/openstackclient/tests/unit/volume/v2/test_volume.py b/openstackclient/tests/unit/volume/v2/test_volume.py index ec82e6746b..b6e9f487f2 100644 --- a/openstackclient/tests/unit/volume/v2/test_volume.py +++ b/openstackclient/tests/unit/volume/v2/test_volume.py @@ -108,11 +108,9 @@ class TestVolumeCreate(TestVolume): def test_volume_create_min_options(self): arglist = [ '--size', str(self.new_volume.size), - self.new_volume.name, ] verifylist = [ ('size', self.new_volume.size), - ('name', self.new_volume.name), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -124,7 +122,7 @@ class TestVolumeCreate(TestVolume): self.volumes_mock.create.assert_called_with( size=self.new_volume.size, snapshot_id=None, - name=self.new_volume.name, + name=None, description=None, volume_type=None, availability_zone=None, diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index 6d14b360de..1e1fde9226 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -82,10 +82,11 @@ class CreateVolume(command.ShowOne): _description = _("Create new volume") def get_parser(self, prog_name): - parser = super(CreateVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "name", metavar="", + nargs="?", help=_("Volume name"), ) parser.add_argument( diff --git a/releasenotes/notes/optional-volume-name-ffbefe463a598b6c.yaml b/releasenotes/notes/optional-volume-name-ffbefe463a598b6c.yaml new file mode 100644 index 0000000000..377d453dee --- /dev/null +++ b/releasenotes/notes/optional-volume-name-ffbefe463a598b6c.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The ```` argument for the ``volume create`` command is now optional.