()
| 330 | gdata["zk_client"].stop() |
| 331 | |
| 332 | def main(): |
| 333 | logging.basicConfig() |
| 334 | check_conf() |
| 335 | expand_conf() |
| 336 | opts = getOpts() |
| 337 | if opts.setup_config: |
| 338 | create_default_conf() |
| 339 | sys.exit(0) |
| 340 | if opts.print_default_config: |
| 341 | print dict_to_json(json_to_dict(get_default_conf()), True) |
| 342 | sys.exit(0) |
| 343 | |
| 344 | # is the conf still not setup |
| 345 | if gdata['conf_data'] == None: |
| 346 | print "No config found, run with '--setup-config' to set it up." |
| 347 | sys.exit(1) |
| 348 | |
| 349 | if opts.version == True: |
| 350 | from seldon import __version__ |
| 351 | print __version__ |
| 352 | sys.exit(0) |
| 353 | |
| 354 | if len(opts.args) < 1: |
| 355 | print "Need command" |
| 356 | sys.exit(1) |
| 357 | |
| 358 | if opts.zk_hosts != None: |
| 359 | gdata["conf_data"]["zk_hosts"] = opts.zk_hosts |
| 360 | else: |
| 361 | opts.zk_hosts = gdata["conf_data"]["zk_hosts"] |
| 362 | |
| 363 | cmd = opts.args[0] |
| 364 | command_args = opts.args[1:] |
| 365 | |
| 366 | cmds = gdata['cmds'] |
| 367 | if cmds.has_key(cmd): |
| 368 | start_zk_client(opts) |
| 369 | command_data = { |
| 370 | 'conf_data' : gdata['conf_data'], |
| 371 | 'zkdetails' : {'zkroot': gdata['conf_data']['zkroot'], 'zk_client': gdata['zk_client']}, |
| 372 | } |
| 373 | cmds[cmd](opts,command_data, command_args) |
| 374 | stop_zk_client() |
| 375 | else: |
| 376 | print "Invalid command[{}]".format(cmd) |
| 377 | sys.exit(1) |
| 378 | |
| 379 | if __name__ == '__main__': |
| 380 | main() |
no test coverage detected