def main(): try: conf_filename = None api = None force = False debug = False root = "/" delete = False try: opts, arg = getopt.getopt(sys.argv[1:], "hc:vr:df", [ "help", "config-file=", "verbose", "root=", "delete-endpoint", "force" ]) except getopt.GetoptError as e: print("Invalid option " + e.opt, file=sys.stderr) usage(short=True, outstream=sys.stderr) sys.exit(1) if len(arg) > 0: print("Unexpected argument(s) " + " ".join(arg), file=sys.stderr) sys.exit(1) for (o, val) in opts: if o in ['-h', '--help']: usage() sys.exit(0) elif o in ['-c', '--config-file']: conf_filename = val elif o in ['-v', '--verbose']: debug = True elif o in ['-r', '--root']: root = val elif o in ['-d', '--delete-endpoint']: delete = True elif o in ['-f', '--force']: force = True else: print("Unknown option %s" % (o), file=sys.stderr) sys.exit(1) is_latest_version(force) os.umask(0o22) conf = ConfigFile(config_file=conf_filename, root=root) api = get_api(conf) ioobj = IO(config_obj=conf, api=api, debug=debug) id = ID(config_obj=conf, api=api, debug=debug) web = Web(config_obj=conf, api=api, debug=debug) web.cleanup() ioobj.cleanup(delete=delete) id.cleanup() except KeyboardInterrupt as e: print("Aborting...") sys.exit(1) except Exception as e: if debug: traceback.print_exc(file=sys.stderr) else: print(str(e)) sys.exit(1)
def main(): conf_filename = None api = None force = False debug = False reset = False root = "/" try: opts, arg = getopt.getopt( sys.argv[1:], "hc:vr:f", ["help", "config-file=", "verbose", "root=", "force"]) except getopt.GetoptError as e: print("Invalid option " + e.opt, file=sys.stderr) usage(short=True, outstream=sys.stderr) sys.exit(1) if len(arg) > 0: print("Unexpected argument(s) " + " ".join(arg), file=sys.stderr) sys.exit(1) for (o, val) in opts: if o in ['-h', '--help']: usage() sys.exit(0) elif o in ['-c', '--config-file']: conf_filename = val elif o in ['-v', '--verbose']: debug = True elif o in ['-r', '--root']: root = val elif o in ['-f', '--force']: force = True else: print("Unknown option %s" % (o), file=sys.stderr) sys.exit(1) try: is_latest_version(force) os.umask(0o22) socket.setdefaulttimeout(300) conf = ConfigFile(config_file=conf_filename, root=root) api = get_api(conf) web = Web(config_obj=conf, api=api, password=api.password, debug=debug) web.setup() sys.exit(web.errorcount) except KeyboardInterrupt as e: print("Aborting...") sys.exit(1) except Exception as e: if debug: traceback.print_exc(file=sys.stderr) else: print(str(e)) sys.exit(1)
elif o in ['-f', '--force']: force = True else: print("Unknown option %s" % (o), file=sys.stderr) sys.exit(1) try: is_latest_version(force) os.umask(0o22) socket.setdefaulttimeout(300) conf = ConfigFile(config_file=conf_filename, root=root) api = get_api(conf) id = ID(config_obj=conf, api=api, debug=debug) web = Web(config_obj=conf, api=api, password=api.password, debug=debug) ioobj = IO(config_obj=conf, api=api, debug=debug) id.setup() web.setup() ioobj.setup(reset=reset) sys.exit(ioobj.errorcount + id.errorcount + web.errorcount) except KeyboardInterrupt as e: print("Aborting...") sys.exit(1) except Exception as e: if debug: traceback.print_exc(file=sys.stderr) else: print(str(e)) sys.exit(1)
elif o in ['-f', '--force']: force = True else: print("Unknown option %s" %(o), file=sys.stderr) sys.exit(1) try: is_latest_version(force) os.umask(0o22) socket.setdefaulttimeout(300) conf = ConfigFile(config_file=conf_filename, root=root) api = get_api(conf) id = ID(config_obj=conf, api=api, debug=debug) web = Web(config_obj=conf, api=api, password=api.password, debug=debug) ioobj = IO(config_obj=conf, api=api, debug=debug) id.setup() web.setup() ioobj.setup(reset=reset) sys.exit(ioobj.errorcount + id.errorcount + web.errorcount) except KeyboardInterrupt as e: print("Aborting...") sys.exit(1) except Exception as e: if debug: traceback.print_exc(file=sys.stderr) else: print(str(e)) sys.exit(1)
sys.exit(0) elif o in ['-c', '--config-file']: conf_filename = val elif o in ['-v', '--verbose']: debug = True elif o in ['-r', '--root']: root = val else: print >> sys.stderr, "Unknown option %s" % (o) sys.exit(1) try: os.umask(022) socket.setdefaulttimeout(300) conf = ConfigFile(config_file=conf_filename, root=root) api = get_api(conf) web = Web(config_obj=conf, api=api, debug=debug) web.cleanup() except KeyboardInterrupt, e: print "Aborting..." sys.exit(1) except Exception, e: if debug: traceback.print_exc(file=sys.stderr) else: print str(e) sys.exit(1) # vim: filetype=python:
elif o in ['-v', '--verbose']: debug = True elif o in ['-r', '--root']: root = val elif o in ['-d', '--delete-endpoint']: delete = True else: print >>sys.stderr, "Unknown option %s" %(o) sys.exit(1) os.umask(022) conf = ConfigFile(config_file=conf_filename, root=root) api = get_api(conf) io = IO(config_obj=conf, api=api, debug=debug) id = ID(config_obj=conf, api=api, debug=debug) web = Web(config_obj=conf, api=api, debug=debug) web.cleanup() io.cleanup(delete=delete) id.cleanup() except KeyboardInterrupt, e: print "Aborting..." sys.exit(1) except Exception, e: if debug: traceback.print_exc(file=sys.stderr) else: print str(e) sys.exit(1) # vim: filetype=python: