mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-29 11:01:39 +01:00
Merge pull request #11409 from heww/fix-issue-11367
fix(prepare): not accpet items of false value in external_redis
This commit is contained in:
commit
f14a16bedb
@ -402,8 +402,17 @@ def get_redis_configs(external_redis=None, with_clair=True, with_trivy=True):
|
|||||||
>>> get_redis_configs()['trivy_redis_url']
|
>>> get_redis_configs()['trivy_redis_url']
|
||||||
'redis://redis:6379/5'
|
'redis://redis:6379/5'
|
||||||
|
|
||||||
|
>>> get_redis_configs({'host': 'localhost', 'password': ''})['redis_password']
|
||||||
|
''
|
||||||
|
>>> get_redis_configs({'host': 'localhost', 'password': None})['redis_password']
|
||||||
|
''
|
||||||
|
>>> get_redis_configs({'host': 'localhost', 'password': None})['redis_url_reg']
|
||||||
|
'redis://localhost:6379/1'
|
||||||
|
|
||||||
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['external_redis']
|
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['external_redis']
|
||||||
True
|
True
|
||||||
|
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['redis_password']
|
||||||
|
'pass'
|
||||||
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['redis_url_reg']
|
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['redis_url_reg']
|
||||||
'redis://anonymous:pass@localhost:6379/1'
|
'redis://anonymous:pass@localhost:6379/1'
|
||||||
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['redis_url_js']
|
>>> get_redis_configs({'host': 'localhost', 'password': 'pass'})['redis_url_js']
|
||||||
@ -418,6 +427,7 @@ def get_redis_configs(external_redis=None, with_clair=True, with_trivy=True):
|
|||||||
>>> 'trivy_redis_url' not in get_redis_configs(with_trivy=False)
|
>>> 'trivy_redis_url' not in get_redis_configs(with_trivy=False)
|
||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
|
external_redis = external_redis or {}
|
||||||
|
|
||||||
configs = dict(external_redis=bool(external_redis))
|
configs = dict(external_redis=bool(external_redis))
|
||||||
|
|
||||||
@ -435,7 +445,7 @@ def get_redis_configs(external_redis=None, with_clair=True, with_trivy=True):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# overwriting existing keys by external_redis
|
# overwriting existing keys by external_redis
|
||||||
redis.update(external_redis or {})
|
redis.update({key: value for (key, value) in external_redis.items() if value})
|
||||||
|
|
||||||
configs['redis_host'] = redis['host']
|
configs['redis_host'] = redis['host']
|
||||||
configs['redis_port'] = redis['port']
|
configs['redis_port'] = redis['port']
|
||||||
|
Loading…
Reference in New Issue
Block a user