gitops-configserver 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/__init__.py +14 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/cli.py +51 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/config.py +27 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/__init__.py +14 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/cli.py +51 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/config.py +27 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/__init__.py +14 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/cli.py +51 -0
- build/lib/build/lib/build/lib/build/lib/build/lib/gitops_mt/config.py +27 -0
- build/lib/build/lib/build/lib/build/lib/gitops_mt/__init__.py +14 -0
- build/lib/build/lib/build/lib/build/lib/gitops_mt/cli.py +51 -0
- build/lib/build/lib/build/lib/build/lib/gitops_mt/config.py +27 -0
- build/lib/build/lib/build/lib/gitops_mt/__init__.py +14 -0
- build/lib/build/lib/build/lib/gitops_mt/cli.py +51 -0
- build/lib/build/lib/build/lib/gitops_mt/config.py +27 -0
- build/lib/build/lib/gitops_mt/__init__.py +14 -0
- build/lib/build/lib/gitops_mt/cli.py +51 -0
- build/lib/build/lib/gitops_mt/config.py +27 -0
- build/lib/gitops_mt/__init__.py +14 -0
- build/lib/gitops_mt/cli.py +51 -0
- build/lib/gitops_mt/config.py +27 -0
- build/lib/tests/__init__.py +0 -0
- build/lib/tests/test_rendering.py +153 -0
- build/lib/tests/test_variables_resolver.py +63 -0
- gitops_configserver/__init__.py +14 -0
- gitops_configserver/cli.py +87 -0
- gitops_configserver/config.py +45 -0
- gitops_configserver/configs/__init__.py +1 -0
- gitops_configserver/configs/views.py +22 -0
- gitops_configserver/extensions.py +8 -0
- gitops_configserver/git.py +90 -0
- gitops_configserver/server.py +15 -0
- gitops_configserver/templates_rendering.py +169 -0
- gitops_configserver/utils.py +39 -0
- gitops_configserver/workflow.py +71 -0
- gitops_configserver-1.0.1.dist-info/LICENSE +2 -0
- gitops_configserver-1.0.1.dist-info/METADATA +56 -0
- gitops_configserver-1.0.1.dist-info/RECORD +46 -0
- gitops_configserver-1.0.1.dist-info/WHEEL +5 -0
- gitops_configserver-1.0.1.dist-info/top_level.txt +8 -0
- gitops_mt/__init__.py +14 -0
- gitops_mt/cli.py +51 -0
- gitops_mt/config.py +27 -0
- tests/__init__.py +0 -0
- tests/test_rendering.py +153 -0
- tests/test_variables_resolver.py +63 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from os.path import join, dirname
|
|
2
|
+
from importlib import metadata
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read(fname):
|
|
7
|
+
with open(join(dirname(__file__), fname)) as f:
|
|
8
|
+
return f.read()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = metadata.version("gitops-mt")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
__version__ = read(join("..", "VERSION")).strip()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from argparse import Namespace, ArgumentParser
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from gitops_mt.config import setup_logger, Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbstractArgumentsHandler(ABC):
|
|
7
|
+
"""Command pattern interface"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def execute(self, args) -> None:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_parser(self, subparsers):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConfigGeneratorHandler(AbstractArgumentsHandler):
|
|
19
|
+
def execute(self, args):
|
|
20
|
+
config = Config()
|
|
21
|
+
print("HELLO WORLD")
|
|
22
|
+
|
|
23
|
+
def add_parser(self, subparsers):
|
|
24
|
+
parser_config_generator = subparsers.add_parser("config_gen")
|
|
25
|
+
parser_config_generator.set_defaults(func=self.execute)
|
|
26
|
+
parser_config_generator.add_argument(
|
|
27
|
+
"--config_dir",
|
|
28
|
+
type=str,
|
|
29
|
+
help="Config directory",
|
|
30
|
+
dest="config_dir",
|
|
31
|
+
required=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_arguments() -> Namespace:
|
|
36
|
+
parser = ArgumentParser(
|
|
37
|
+
description="GitOps multitenancy templates generator"
|
|
38
|
+
)
|
|
39
|
+
subparsers = parser.add_subparsers(required=True)
|
|
40
|
+
ConfigGeneratorHandler().add_parser(subparsers)
|
|
41
|
+
return parser.parse_args()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> None:
|
|
45
|
+
setup_logger()
|
|
46
|
+
args = parse_arguments()
|
|
47
|
+
args.func(args)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from os import getenv, path
|
|
2
|
+
import logging
|
|
3
|
+
import logging.config
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def file_exists(fname):
|
|
8
|
+
return path.isfile(fname)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def setup_logger():
|
|
12
|
+
if file_exists(Config.LOGGER_CONFIG_FILE):
|
|
13
|
+
with open(Config.LOGGER_CONFIG_FILE, "rt") as f:
|
|
14
|
+
config = yaml.safe_load(f.read())
|
|
15
|
+
logging.config.dictConfig(config)
|
|
16
|
+
else:
|
|
17
|
+
logging.basicConfig(filename="myapp.log", level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
logger.info("Started")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
LOGGER_CONFIG_FILE = getenv(
|
|
24
|
+
"GITOPS_MT__LOGGER_CONFIG_FILE", path.join("resources", "logger.yaml")
|
|
25
|
+
)
|
|
26
|
+
CONFIG_DIR = getenv("GITOPS_MT__CONFIG_DIR")
|
|
27
|
+
LOGS_VERBOSE = True
|
|
File without changes
|