Revision 8b72b05c daemons/ganeti-rapi
b/daemons/ganeti-rapi | ||
---|---|---|
214 | 214 |
|
215 | 215 |
ssconf.CheckMaster(options.debug) |
216 | 216 |
|
217 |
# Read SSL certificate (this is a little hackish to read the cert as root) |
|
218 |
if options.ssl: |
|
219 |
options.ssl_params = http.HttpSslParams(ssl_key_path=options.ssl_key, |
|
220 |
ssl_cert_path=options.ssl_cert) |
|
221 |
else: |
|
222 |
options.ssl_params = None |
|
223 |
|
|
217 | 224 |
|
218 | 225 |
def ExecRapi(options, _): |
219 | 226 |
"""Main remote API function, executed with the PID file held. |
220 | 227 |
|
221 | 228 |
""" |
222 |
# Read SSL certificate |
|
223 |
if options.ssl: |
|
224 |
ssl_params = http.HttpSslParams(ssl_key_path=options.ssl_key, |
|
225 |
ssl_cert_path=options.ssl_cert) |
|
226 |
else: |
|
227 |
ssl_params = None |
|
228 | 229 |
|
229 | 230 |
mainloop = daemon.Mainloop() |
230 | 231 |
server = RemoteApiHttpServer(mainloop, options.bind_address, options.port, |
231 |
ssl_params=ssl_params, ssl_verify_peer=False, |
|
232 |
ssl_params=options.ssl_params, |
|
233 |
ssl_verify_peer=False, |
|
232 | 234 |
request_executor_class=JsonErrorRequestExecutor) |
233 | 235 |
# pylint: disable-msg=E1101 |
234 | 236 |
# it seems pylint doesn't see the second parent class there |
... | ... | |
251 | 253 |
dirs.append((constants.LOG_OS_DIR, 0750)) |
252 | 254 |
daemon.GenericMain(constants.RAPI, parser, dirs, CheckRapi, ExecRapi, |
253 | 255 |
default_ssl_cert=constants.RAPI_CERT_FILE, |
254 |
default_ssl_key=constants.RAPI_CERT_FILE) |
|
256 |
default_ssl_key=constants.RAPI_CERT_FILE, |
|
257 |
user=constants.RAPI_USER, group=constants.DAEMONS_GROUP) |
|
255 | 258 |
|
256 | 259 |
|
257 | 260 |
if __name__ == "__main__": |
Also available in: Unified diff