Refine the python file to make it run on python3

This commit is contained in:
Tan Jiang 2018-03-30 14:41:12 +08:00
parent 892d9bf023
commit 1e260b59fe
2 changed files with 6 additions and 6 deletions

View File

@ -26,12 +26,12 @@ default = {
def migrate(input_cfg, output_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',
'ssl_cert', 'ssl_cert_key', 'secretkey_path', 'admiral_url', 'db_password', 'clair_db_password'])
val = {}
for k in keys:
if d.has_key(k):
if k in d:
val[k] = d[k]
else:
val[k] = default[k]

View File

@ -29,13 +29,13 @@ def read_conf(path):
def get_conf_version(path):
d = read_conf(path)
# print json.dumps(d,indent=4)
if d.has_key("_version"): # >=1.5.0
if "_version" in d: # >=1.5.0
return d["_version"]
if not d.has_key("clair_db_password"):
if not "clair_db_password" in d:
return "unsupported"
if d.has_key("registry_storage_provider_name"):
if "registry_storage_provider_name" in d:
return "1.4.0"
if d.has_key("uaa_endpoint"):
if "uaa_endpoint" in d:
return "1.3.0"
return "1.2.0"