mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 08:38:03 +01:00
Refine the python file to make it run on python3
This commit is contained in:
parent
2debdb7229
commit
b1923bf219
@ -26,12 +26,12 @@ default = {
|
|||||||
|
|
||||||
def migrate(input_cfg, output_cfg):
|
def migrate(input_cfg, output_cfg):
|
||||||
d = utils.read_conf(input_cfg)
|
d = utils.read_conf(input_cfg)
|
||||||
keys = default.keys()
|
keys = list(default.keys())
|
||||||
keys.extend(['hostname', 'ui_url_protocol', 'max_job_workers', 'customize_crt',
|
keys.extend(['hostname', 'ui_url_protocol', 'max_job_workers', 'customize_crt',
|
||||||
'ssl_cert', 'ssl_cert_key', 'secretkey_path', 'admiral_url', 'db_password', 'clair_db_password'])
|
'ssl_cert', 'ssl_cert_key', 'secretkey_path', 'admiral_url', 'db_password', 'clair_db_password'])
|
||||||
val = {}
|
val = {}
|
||||||
for k in keys:
|
for k in keys:
|
||||||
if d.has_key(k):
|
if k in d:
|
||||||
val[k] = d[k]
|
val[k] = d[k]
|
||||||
else:
|
else:
|
||||||
val[k] = default[k]
|
val[k] = default[k]
|
||||||
|
@ -29,13 +29,13 @@ def read_conf(path):
|
|||||||
def get_conf_version(path):
|
def get_conf_version(path):
|
||||||
d = read_conf(path)
|
d = read_conf(path)
|
||||||
# print json.dumps(d,indent=4)
|
# print json.dumps(d,indent=4)
|
||||||
if d.has_key("_version"): # >=1.5.0
|
if "_version" in d: # >=1.5.0
|
||||||
return d["_version"]
|
return d["_version"]
|
||||||
if not d.has_key("clair_db_password"):
|
if not "clair_db_password" in d:
|
||||||
return "unsupported"
|
return "unsupported"
|
||||||
if d.has_key("registry_storage_provider_name"):
|
if "registry_storage_provider_name" in d:
|
||||||
return "1.4.0"
|
return "1.4.0"
|
||||||
if d.has_key("uaa_endpoint"):
|
if "uaa_endpoint" in d:
|
||||||
return "1.3.0"
|
return "1.3.0"
|
||||||
return "1.2.0"
|
return "1.2.0"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user