-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be4ea41
commit 4e6a5b7
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from oslo_serialization import jsonutils | ||
|
||
|
||
def root(host_url): | ||
return { | ||
"name": "ESI Leap API", | ||
"description": "ESI Leap is an OpenStack service for leasing baremetal nodes, designed to run on top of multi-tenant Ironic.", | ||
"versions": [ | ||
{ | ||
"id": "v1.0", | ||
"status": "CURRENT", | ||
"links": [{"href": "{0}/v1".format(host_url), "rel": "self"}], | ||
} | ||
], | ||
} | ||
|
||
|
||
class Health(object): | ||
def __init__(self, app, path): | ||
self.app = app | ||
self.path = path | ||
|
||
def __call__(self, environ, start_response): | ||
if environ["PATH_INFO"] == self.path: | ||
start_response("200 OK", [("Content-Type", "application/json")]) | ||
return [ | ||
jsonutils.dump_as_bytes( | ||
root(environ["wsgi.url_scheme"] + "://" + environ["HTTP_HOST"]) | ||
) | ||
] | ||
return self.app(environ, start_response) |