Revision 8c96d01f daemons/ganeti-rapi
b/daemons/ganeti-rapi | ||
---|---|---|
184 | 184 |
|
185 | 185 |
""" |
186 | 186 |
parser = optparse.OptionParser(description="Ganeti Remote API", |
187 |
usage="%prog [-d] [-p port]",
|
|
187 |
usage="%prog [-d]", |
|
188 | 188 |
version="%%prog (ganeti) %s" % |
189 | 189 |
constants.RAPI_VERSION) |
190 | 190 |
parser.add_option("-d", "--debug", dest="debug", |
191 | 191 |
help="Enable some debug messages", |
192 | 192 |
default=False, action="store_true") |
193 |
parser.add_option("-p", "--port", dest="port", |
|
194 |
help="Port to run API (%s default)." % |
|
195 |
constants.RAPI_PORT, |
|
196 |
default=constants.RAPI_PORT, type="int") |
|
197 | 193 |
parser.add_option("--no-ssl", dest="ssl", |
198 | 194 |
help="Do not secure HTTP protocol with SSL", |
199 | 195 |
default=True, action="store_false") |
... | ... | |
213 | 209 |
options, args = parser.parse_args() |
214 | 210 |
|
215 | 211 |
if len(args) != 0: |
216 |
print >> sys.stderr, "Usage: %s [-d] [-p port]" % sys.argv[0]
|
|
212 |
print >> sys.stderr, "Usage: %s [-d]" % sys.argv[0] |
|
217 | 213 |
sys.exit(constants.EXIT_FAILURE) |
218 | 214 |
|
219 | 215 |
if options.ssl and not (options.ssl_cert and options.ssl_key): |
... | ... | |
245 | 241 |
ssl_params = None |
246 | 242 |
|
247 | 243 |
ssconf.CheckMaster(options.debug) |
244 |
port = utils.GetDaemonPort(constants.RAPI) |
|
248 | 245 |
|
249 | 246 |
if options.fork: |
250 | 247 |
utils.Daemonize(logfile=constants.LOG_RAPISERVER) |
... | ... | |
255 | 252 |
utils.WritePidFile(constants.RAPI_PID) |
256 | 253 |
try: |
257 | 254 |
mainloop = daemon.Mainloop() |
258 |
server = RemoteApiHttpServer(mainloop, options.bind_address, options.port,
|
|
255 |
server = RemoteApiHttpServer(mainloop, options.bind_address, port, |
|
259 | 256 |
ssl_params=ssl_params, ssl_verify_peer=False, |
260 | 257 |
request_executor_class= |
261 | 258 |
JsonErrorRequestExecutor) |
Also available in: Unified diff