ValueError when running manila list --count True"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Shared File Systems Service (Manila) |
Fix Released
|
Medium
|
Victoria Martinez de la Cruz |
Bug Description
ValueError when running manila list --count True"
This happens because cs.shares.list can return different data types depending on what's requested and what shares exist.
This code makes an assumption that if "with_count" is specified, cs.shares.list will return a tuple of (shares, total_count). But if there are no shares, it only returns [].
manilaclient @ 6c11461
$ manila list
+----+-
| ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone |
+----+-
+----+-
$ manila list --count True
ERROR: need more than 0 values to unpack
$ manila --debug list --count True
<snip>
DEBUG (httpclient:199)
REQ: curl -i -X GET http://
RESP: [200] {'content-length': '14', 'x-compute-
RESP BODY: {"shares": []}
DEBUG (httpclient:208) RESP: [200] {'content-length': '14', 'x-compute-
RESP BODY: {"shares": []}
DEBUG (shell:707) need more than 0 values to unpack
Traceback (most recent call last):
File "/opt/stack/
map(
File "/opt/stack/
args.
File "/opt/stack/
sort_
ValueError: need more than 0 values to unpack
ERROR: need more than 0 values to unpack
Changed in python-manilaclient: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
milestone: | none → train-1 |
Changed in python-manilaclient: | |
milestone: | train-1 → train-2 |
Changed in python-manilaclient: | |
assignee: | nobody → Soledad Kuczala (solkz) |
Changed in python-manilaclient: | |
status: | Confirmed → In Progress |
affects: | python-manilaclient → manila |
Changed in manila: | |
milestone: | train-2 → none |
Changed in manila: | |
assignee: | Soledad Kuczala (solkz) → Victoria Martinez de la Cruz (vkmc) |
Changed in manila: | |
assignee: | Victoria Martinez de la Cruz (vkmc) → nobody |
Changed in manila: | |
assignee: | nobody → Soledad Kuczala (solkz) |
Changed in manila: | |
assignee: | Soledad Kuczala (solkz) → Victoria Martinez de la Cruz (vkmc) |
maybe we can do something along these lines ...
diff --git a/manilaclient/ v2/shell. py b/manilaclient/ v2/shell. py v2/shell. py v2/shell. py bool_from_ string( args.count, strict=True):
search_ opts['with_ count'] = args.count opts=search_ opts, sort_key= args.sort_ key, args.sort_ dir, opts=search_ opts, sort_key= args.sort_ key, args.sort_ dir,
search_ opts=search_ opts, sort_key= args.sort_ key,
index 0a5646c..1a3c20d 100644
--- a/manilaclient/
+++ b/manilaclient/
@@ -1931,10 +1931,13 @@ def do_list(cs, args):
total_count = 0
if strutils.
- shares, total_count = cs.shares.list(
- search_
- sort_dir=
- )
+ try:
+ shares, total_count = cs.shares.list(
+ search_
+ sort_dir=
+ )
+ except ValueError:
+ shares, total_count = [], 0
else:
shares = cs.shares.list(