def main() -> int: parser = argparse.ArgumentParser( prog="karapace rest", description="Karapace: Your Kafka essentials in one tool") parser.add_argument("--version", action="version", help="show program version", version=karapace_version.__version__) parser.add_argument("config_file", help="configuration file path", type=argparse.FileType()) arg = parser.parse_args() with closing(arg.config_file): config = read_config(arg.config_file) kc = KafkaRest(config_file_path=arg.config_file.name, config=config) try: kc.run(host=kc.config["host"], port=kc.config["port"]) except Exception: # pylint: disable-broad-except if kc.raven_client: kc.raven_client.captureException(tags={"where": "karapace_rest"}) raise return 0
def main() -> int: parser = argparse.ArgumentParser(prog="karapace rest", description="Karapace: Your Kafka essentials in one tool") parser.add_argument("--version", action="version", help="show program version", version=karapace_version.__version__) parser.add_argument("config_file", help="configuration file path", type=argparse.FileType()) arg = parser.parse_args() with closing(arg.config_file): config = read_config(arg.config_file) logging.basicConfig(level=logging.INFO, format=DEFAULT_LOG_FORMAT_JOURNAL) logging.getLogger().setLevel(config["log_level"]) kc = KafkaRest(config=config) try: kc.run(host=kc.config["host"], port=kc.config["port"]) except Exception: # pylint: disable-broad-except if kc.raven_client: kc.raven_client.captureException(tags={"where": "karapace_rest"}) raise return 0
def main(): parser = argparse.ArgumentParser(prog="karapace rest", description="Karapace: Your Kafka essentials in one tool") parser.add_argument("--version", action="version", help="show program version", version=karapace_version.__version__) parser.add_argument("config_file", help="configuration file path") arg = parser.parse_args() if not os.path.exists(arg.config_file): print("Config file: {} does not exist, exiting".format(arg.config_file)) return 1 kc = KafkaRest(arg.config_file) try: return kc.run(host=kc.config["host"], port=kc.config["port"]) except Exception: # pylint: disable-broad-except if kc.raven_client: kc.raven_client.captureException(tags={"where": "karapace_rest"}) raise