Revision e0003509 lib/server/rapi.py
b/lib/server/rapi.py | ||
---|---|---|
82 | 82 |
return serializer.DumpJson(values) |
83 | 83 |
|
84 | 84 |
|
85 |
class RemoteApiHttpServer(http.auth.HttpServerRequestAuthentication,
|
|
86 |
http.server.HttpServer):
|
|
85 |
class RemoteApiHandler(http.auth.HttpServerRequestAuthentication,
|
|
86 |
http.server.HttpServerHandler):
|
|
87 | 87 |
"""REST Request Handler Class. |
88 | 88 |
|
89 | 89 |
""" |
90 | 90 |
AUTH_REALM = "Ganeti Remote API" |
91 | 91 |
|
92 |
def __init__(self, *args, **kwargs):
|
|
92 |
def __init__(self): |
|
93 | 93 |
# pylint: disable=W0233 |
94 | 94 |
# it seems pylint doesn't see the second parent class there |
95 |
http.server.HttpServer.__init__(self, *args, **kwargs)
|
|
95 |
http.server.HttpServerHandler.__init__(self)
|
|
96 | 96 |
http.auth.HttpServerRequestAuthentication.__init__(self) |
97 | 97 |
self._resmap = connector.Mapper() |
98 | 98 |
self._users = None |
... | ... | |
308 | 308 |
"""Prep remote API function, executed with the PID file held. |
309 | 309 |
|
310 | 310 |
""" |
311 |
|
|
312 | 311 |
mainloop = daemon.Mainloop() |
313 |
server = RemoteApiHttpServer(mainloop, options.bind_address, options.port, |
|
314 |
ssl_params=options.ssl_params, |
|
315 |
ssl_verify_peer=False, |
|
316 |
request_executor_class=JsonErrorRequestExecutor) |
|
312 |
handler = RemoteApiHandler() |
|
317 | 313 |
|
318 | 314 |
# Setup file watcher (it'll be driven by asyncore) |
319 | 315 |
SetupFileWatcher(constants.RAPI_USERS_FILE, |
320 |
compat.partial(server.LoadUsers, constants.RAPI_USERS_FILE))
|
|
316 |
compat.partial(handler.LoadUsers, constants.RAPI_USERS_FILE))
|
|
321 | 317 |
|
322 |
server.LoadUsers(constants.RAPI_USERS_FILE)
|
|
318 |
handler.LoadUsers(constants.RAPI_USERS_FILE)
|
|
323 | 319 |
|
324 |
# pylint: disable=E1101 |
|
325 |
# it seems pylint doesn't see the second parent class there |
|
320 |
server = \ |
|
321 |
http.server.HttpServer(mainloop, options.bind_address, options.port, |
|
322 |
handler, ssl_params=options.ssl_params, ssl_verify_peer=False, |
|
323 |
request_executor_class=JsonErrorRequestExecutor) |
|
326 | 324 |
server.Start() |
327 | 325 |
|
328 | 326 |
return (mainloop, server) |
Also available in: Unified diff