|
1 | 1 | from avro.errors import SchemaParseException |
2 | | -from contextlib import closing |
3 | 2 | from enum import Enum, unique |
4 | 3 | from http import HTTPStatus |
5 | 4 | from kafka import KafkaProducer |
6 | | -from karapace import version as karapace_version |
7 | 5 | from karapace.compatibility import check_compatibility, CompatibilityModes |
8 | 6 | from karapace.compatibility.jsonschema.checks import is_incompatible |
9 | | -from karapace.config import DEFAULT_LOG_FORMAT_JOURNAL, read_config |
10 | 7 | from karapace.karapace import KarapaceBase |
11 | 8 | from karapace.master_coordinator import MasterCoordinator |
12 | 9 | from karapace.rapu import HTTPRequest |
13 | 10 | from karapace.schema_reader import InvalidSchema, KafkaSchemaReader, SchemaType, TypedSchema |
14 | 11 | from karapace.utils import json_encode, KarapaceKafkaClient |
15 | 12 | from typing import Any, Dict, Optional, Tuple |
16 | 13 |
|
17 | | -import argparse |
18 | 14 | import asyncio |
19 | | -import logging |
20 | | -import sys |
21 | 15 | import time |
22 | 16 |
|
23 | 17 |
|
@@ -907,29 +901,3 @@ def no_master_error(self, content_type): |
907 | 901 | content_type=content_type, |
908 | 902 | status=HTTPStatus.INTERNAL_SERVER_ERROR, |
909 | 903 | ) |
910 | | - |
911 | | - |
912 | | -def main() -> int: |
913 | | - parser = argparse.ArgumentParser(prog="karapace", description="Karapace: Your Kafka essentials in one tool") |
914 | | - parser.add_argument("--version", action="version", help="show program version", version=karapace_version.__version__) |
915 | | - parser.add_argument("config_file", help="configuration file path", type=argparse.FileType()) |
916 | | - arg = parser.parse_args() |
917 | | - |
918 | | - with closing(arg.config_file): |
919 | | - config = read_config(arg.config_file) |
920 | | - |
921 | | - logging.basicConfig(level=logging.INFO, format=DEFAULT_LOG_FORMAT_JOURNAL) |
922 | | - logging.getLogger().setLevel(config["log_level"]) |
923 | | - kc = KarapaceSchemaRegistry(config=config) |
924 | | - try: |
925 | | - kc.run(host=kc.config["host"], port=kc.config["port"]) |
926 | | - except Exception: # pylint: disable-broad-except |
927 | | - if kc.raven_client: |
928 | | - kc.raven_client.captureException(tags={"where": "karapace"}) |
929 | | - raise |
930 | | - |
931 | | - return 0 |
932 | | - |
933 | | - |
934 | | -if __name__ == "__main__": |
935 | | - sys.exit(main()) |
0 commit comments