ceph-rest-api: do not include single-option CephChoices in prefix

This breaks commands like

COMMAND("fs flag set name=flag_name,type=CephChoices,strings=enable_multiple "
        "name=val,type=CephString", \
	"Set a global CephFS flag", \
	"fs", "rw", "cli,rest")

with only one option:

PUT fs/flag/set?flag_name=enable_multiple&val=true:  400
FAILURE: url  http://localhost:5000/api/v0.1/fs/flag/set?flag_name=enable_multiple&val=true
expected 200, got 400
Response content:  <html><body><table border=1><th>Possible commands:</th><th>Method</th><th>Description</th><tr><td>fs/flag/set?flag_name=enable_multiple&amp;va
l=val(&lt;string&gt;)
</td><td>PUT</td><td>Set a global CephFS flag</td></tr>
</table></body></html>

...and I can't tell why it's there.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2016-04-04 08:39:32 -04:00
parent 77aee99835
commit 42e692a9ff

View File

@ -224,15 +224,6 @@ def generate_url_and_params(app, sig, flavor):
# prefixes go in the URL path
if desc.t == CephPrefix:
url += '/' + desc.instance.prefix
# CephChoices with 1 required string (not --) do too, unless
# we've already started collecting params, in which case they
# too are params
elif (desc.t == CephChoices and
len(desc.instance.strings) == 1 and
desc.req and
not str(desc.instance).startswith('--') and
not params):
url += '/' + str(desc.instance)
else:
# tell/<target> is a weird case; the URL includes what
# would everywhere else be a parameter