2018-11-15 04:09:57 +01:00
|
|
|
import os, shutil
|
|
|
|
|
2020-02-11 06:47:55 +01:00
|
|
|
from g import config_dir, templates_dir, DEFAULT_GID, DEFAULT_UID
|
2019-08-01 10:02:08 +02:00
|
|
|
from utils.misc import prepare_dir
|
2018-11-15 04:09:57 +01:00
|
|
|
from utils.jinja import render_jinja
|
|
|
|
|
|
|
|
registryctl_config_dir = os.path.join(config_dir, "registryctl")
|
|
|
|
registryctl_config_template_path = os.path.join(templates_dir, "registryctl", "config.yml.jinja")
|
|
|
|
registryctl_conf = os.path.join(config_dir, "registryctl", "config.yml")
|
|
|
|
registryctl_env_template_path = os.path.join(templates_dir, "registryctl", "env.jinja")
|
|
|
|
registryctl_conf_env = os.path.join(config_dir, "registryctl", "env")
|
|
|
|
|
|
|
|
def prepare_registry_ctl(config_dict):
|
|
|
|
# prepare dir
|
2020-02-11 06:47:55 +01:00
|
|
|
prepare_dir(registryctl_config_dir)
|
2018-11-15 04:09:57 +01:00
|
|
|
|
2020-02-11 06:47:55 +01:00
|
|
|
# Render Registryctl env
|
2018-11-15 04:09:57 +01:00
|
|
|
render_jinja(
|
|
|
|
registryctl_env_template_path,
|
|
|
|
registryctl_conf_env,
|
|
|
|
**config_dict)
|
|
|
|
|
2020-02-11 06:47:55 +01:00
|
|
|
# Render Registryctl config
|
|
|
|
render_jinja(
|
|
|
|
registryctl_config_template_path,
|
|
|
|
registryctl_conf,
|
|
|
|
uid=DEFAULT_UID,
|
|
|
|
gid=DEFAULT_GID,
|
|
|
|
**config_dict)
|