mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 19:56:09 +01:00
Merge pull request #13754 from ninjadq/fix_loglevel_parsing_for_registry
Fix log level issue in registry
This commit is contained in:
commit
64fcfeaa2f
@ -1,6 +1,6 @@
|
|||||||
version: 0.1
|
version: 0.1
|
||||||
log:
|
log:
|
||||||
level: {{log_level}}
|
level: {{level}}
|
||||||
fields:
|
fields:
|
||||||
service: registry
|
service: registry
|
||||||
storage:
|
storage:
|
||||||
|
@ -11,5 +11,5 @@ https_config:
|
|||||||
protocol: "http"
|
protocol: "http"
|
||||||
port: 8080
|
port: 8080
|
||||||
{% endif %}
|
{% endif %}
|
||||||
log_level: "INFO"
|
log_level: {{level}}
|
||||||
registry_config: "/etc/registry/config.yml"
|
registry_config: "/etc/registry/config.yml"
|
||||||
|
@ -20,7 +20,6 @@ levels_map = {
|
|||||||
'fatal': 'fatal'
|
'fatal': 'fatal'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def prepare_registry(config_dict):
|
def prepare_registry(config_dict):
|
||||||
prepare_dir(registry_data_dir, uid=DEFAULT_UID, gid=DEFAULT_GID)
|
prepare_dir(registry_data_dir, uid=DEFAULT_UID, gid=DEFAULT_GID)
|
||||||
prepare_dir(registry_config_dir)
|
prepare_dir(registry_config_dir)
|
||||||
@ -42,7 +41,6 @@ def prepare_registry(config_dict):
|
|||||||
storage_provider_info=storage_provider_info,
|
storage_provider_info=storage_provider_info,
|
||||||
**config_dict, **redis_ops)
|
**config_dict, **redis_ops)
|
||||||
|
|
||||||
|
|
||||||
def parse_redis(redis_url):
|
def parse_redis(redis_url):
|
||||||
u = urlsplit(redis_url)
|
u = urlsplit(redis_url)
|
||||||
if not u.scheme or u.scheme == 'redis':
|
if not u.scheme or u.scheme == 'redis':
|
||||||
@ -81,7 +79,6 @@ def get_storage_provider_info(provider_name, provider_config):
|
|||||||
storage_provider_info = ('\n' + ' ' * 4).join(storage_provider_conf_list)
|
storage_provider_info = ('\n' + ' ' * 4).join(storage_provider_conf_list)
|
||||||
return storage_provider_info
|
return storage_provider_info
|
||||||
|
|
||||||
|
|
||||||
def gen_passwd_file(config_dict):
|
def gen_passwd_file(config_dict):
|
||||||
return subprocess.call(["/usr/bin/htpasswd", "-bcB", registry_passwd_path, config_dict['registry_username'],
|
return subprocess.call(["/usr/bin/htpasswd", "-bcB", registry_passwd_path, config_dict['registry_username'],
|
||||||
config_dict['registry_password']], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
config_dict['registry_password']], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
||||||
|
@ -10,6 +10,14 @@ registryctl_conf = os.path.join(config_dir, "registryctl", "config.yml")
|
|||||||
registryctl_env_template_path = os.path.join(templates_dir, "registryctl", "env.jinja")
|
registryctl_env_template_path = os.path.join(templates_dir, "registryctl", "env.jinja")
|
||||||
registryctl_conf_env = os.path.join(config_dir, "registryctl", "env")
|
registryctl_conf_env = os.path.join(config_dir, "registryctl", "env")
|
||||||
|
|
||||||
|
levels_map = {
|
||||||
|
'debug': 'debug',
|
||||||
|
'info': 'info',
|
||||||
|
'warning': 'warn',
|
||||||
|
'error': 'error',
|
||||||
|
'fatal': 'fatal'
|
||||||
|
}
|
||||||
|
|
||||||
def prepare_registry_ctl(config_dict):
|
def prepare_registry_ctl(config_dict):
|
||||||
# prepare dir
|
# prepare dir
|
||||||
prepare_dir(registryctl_config_dir)
|
prepare_dir(registryctl_config_dir)
|
||||||
@ -26,4 +34,5 @@ def prepare_registry_ctl(config_dict):
|
|||||||
registryctl_conf,
|
registryctl_conf,
|
||||||
uid=DEFAULT_UID,
|
uid=DEFAULT_UID,
|
||||||
gid=DEFAULT_GID,
|
gid=DEFAULT_GID,
|
||||||
|
level=levels_map[config_dict['log_level']],
|
||||||
**config_dict)
|
**config_dict)
|
||||||
|
Loading…
Reference in New Issue
Block a user