summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Verschueren <verschueren.bram@gmail.com>2019-12-13 11:13:54 +0100
committerBram Verschueren <verschueren.bram@gmail.com>2019-12-19 09:48:17 +0100
commit69870ae439f18863979949f5728543a0fb1cbe83 (patch)
tree7055cb03af5612586e8bc7b2ff8b1ce9fd31a841
parent5b3a827a1ff80e4b51c7ede44b84bf640d5b6380 (diff)
downloadpython-openstackclient-69870ae439f18863979949f5728543a0fb1cbe83.tar.gz
Fix faulthy state argument choice
The correct state name for a failing volume snapshot deletion is 'error_deleting' instead of 'error-deleting'. [1] [1] https://opendev.org/openstack/cinder/src/commit/89d6a5042fcb2ede5a0b1112d72fae805ea52fcd/cinder/objects/fields.py#L126 Task: #37844 Story: #2007037 Change-Id: Ia99900ece4f1cd29769b22ddaa3965789d719556
-rw-r--r--doc/source/cli/command-objects/volume-snapshot.rst2
-rw-r--r--openstackclient/tests/functional/volume/v2/test_volume_snapshot.py18
-rw-r--r--openstackclient/volume/v1/volume_snapshot.py4
-rw-r--r--openstackclient/volume/v2/consistency_group_snapshot.py2
-rw-r--r--openstackclient/volume/v2/volume_snapshot.py6
5 files changed, 25 insertions, 7 deletions
diff --git a/doc/source/cli/command-objects/volume-snapshot.rst b/doc/source/cli/command-objects/volume-snapshot.rst
index 30cc77cc..21a89370 100644
--- a/doc/source/cli/command-objects/volume-snapshot.rst
+++ b/doc/source/cli/command-objects/volume-snapshot.rst
@@ -115,7 +115,7 @@ List volume snapshots
.. option:: --status <status>
Filters results by a status.
- ('available', 'error', 'creating', 'deleting' or 'error-deleting')
+ ('available', 'error', 'creating', 'deleting' or 'error_deleting')
.. option:: --name <name>
diff --git a/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py b/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py
index 8d32d997..4977a73e 100644
--- a/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py
+++ b/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py
@@ -121,6 +121,24 @@ class VolumeSnapshotTests(common.BaseVolumeTests):
cmd_output["size"],
)
self.wait_for_status('volume snapshot', name2, 'available')
+
+ raw_output = self.openstack(
+ 'volume snapshot set ' +
+ '--state error_deleting ' +
+ name2
+ )
+ self.assertOutput('', raw_output)
+
+ # Test list --long, --status
+ cmd_output = json.loads(self.openstack(
+ 'volume snapshot list -f json ' +
+ '--long ' +
+ '--status error_deleting'
+ ))
+ names = [x["Name"] for x in cmd_output]
+ self.assertNotIn(name1, names)
+ self.assertIn(name2, names)
+
raw_output = self.openstack(
'volume snapshot set ' +
'--state error ' +
diff --git a/openstackclient/volume/v1/volume_snapshot.py b/openstackclient/volume/v1/volume_snapshot.py
index 50f81771..bfe249f5 100644
--- a/openstackclient/volume/v1/volume_snapshot.py
+++ b/openstackclient/volume/v1/volume_snapshot.py
@@ -175,10 +175,10 @@ class ListVolumeSnapshot(command.Lister):
'--status',
metavar='<status>',
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_("Filters results by a status. "
"('available', 'error', 'creating', 'deleting'"
- " or 'error-deleting')")
+ " or 'error_deleting')")
)
parser.add_argument(
'--volume',
diff --git a/openstackclient/volume/v2/consistency_group_snapshot.py b/openstackclient/volume/v2/consistency_group_snapshot.py
index 540deb01..3cba4eca 100644
--- a/openstackclient/volume/v2/consistency_group_snapshot.py
+++ b/openstackclient/volume/v2/consistency_group_snapshot.py
@@ -129,7 +129,7 @@ class ListConsistencyGroupSnapshot(command.Lister):
'--status',
metavar="<status>",
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_('Filters results by a status ("available", "error", '
'"creating", "deleting" or "error_deleting")')
)
diff --git a/openstackclient/volume/v2/volume_snapshot.py b/openstackclient/volume/v2/volume_snapshot.py
index 2b26ae32..6cbd1156 100644
--- a/openstackclient/volume/v2/volume_snapshot.py
+++ b/openstackclient/volume/v2/volume_snapshot.py
@@ -230,10 +230,10 @@ class ListVolumeSnapshot(command.Lister):
'--status',
metavar='<status>',
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_("Filters results by a status. "
"('available', 'error', 'creating', 'deleting'"
- " or 'error-deleting')")
+ " or 'error_deleting')")
)
parser.add_argument(
'--volume',
@@ -345,7 +345,7 @@ class SetVolumeSnapshot(command.Command):
'--state',
metavar='<state>',
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_('New snapshot state. ("available", "error", "creating", '
'"deleting", or "error_deleting") (admin only) '
'(This option simply changes the state of the snapshot '