]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-rest-api: do not include single-option CephChoices in prefix
authorSage Weil <sage@redhat.com>
Mon, 4 Apr 2016 12:39:32 +0000 (08:39 -0400)
committerSage Weil <sage@redhat.com>
Mon, 4 Apr 2016 13:38:26 +0000 (09:38 -0400)
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>
src/pybind/ceph_rest_api.py

index 7792013a205cce18d7f5b7b8aa620c9786fc81b6..2dfe6b6140c3705eb3b3a645b11b2f14e0badf53 100755 (executable)
@@ -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