Fix v1 API.

http://<ip>/accelerator/v1 is unreachable without
this patch. But v1 API is supported, even if deprecated.

In devstack Cyborg plugin, v1 API enabling is commented out.
Interested developers can uncomment it before stacking.

To test this:
    token=$(openstack token issue -c id -f value)
    auth="X-Auth-Token: $token"
    ctype="Content-Type: application/json"
    curl -s -H "$ctype" -H "$auth" <url>

Expected output:
    http://192.168.122.4/accelerator/v1
{"id": "v1", "accelerator": [{"href":
 "http://192.168.122.4/accelerator/v2/accelerator", "rel": "self"},
 {"href": "http://192.168.122.4/accelerator/accelerator",
 "rel": "bookmark"}]}

    http://192.168.122.4/accelerator/v1/accelerators
    {}

    http://192.168.122.4/accelerator/v1/deployables
    {"deployables": []}

Change-Id: Ib0c9a235f4c86e60e38b8046904e83f2ea4f5383
This commit is contained in:
Sundar Nadathur 2019-09-24 00:14:38 -07:00
parent 04bbd98e86
commit 72df50f91e
2 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from pecan import rest
from wsme import types as wtypes
from cyborg.api.controllers import base
from cyborg.api.controllers import v1
from cyborg.api.controllers import v2
from cyborg.api import expose
@ -51,6 +52,7 @@ class RootController(rest.RestController):
"""The default API version"""
v2 = v2.Controller()
v1 = v1.Controller()
@expose.expose(Root)
def get(self):

View File

@ -135,6 +135,13 @@ function create_cyborg_accounts {
"$CYBORG_API_URL/v2" \
"$CYBORG_API_URL/v2" \
"$CYBORG_API_URL/v2"
# NOTE (Sundar): If you need v1 API, enable the section below.
# get_or_create_service "cyborg_legacy" "accelerator_legacy" "Cyborg Legacy"
# get_or_create_endpoint "cyborg_legacy" \
# "$REGION_NAME" \
# "$CYBORG_API_URL/v1" \
# "$CYBORG_API_URL/v1" \
# "$CYBORG_API_URL/v1"
fi
}