mirror of https://github.com/docker/compose.git
Improve process_healthcheck readability
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
aa1fb67495
commit
3cfa0bd162
|
@ -787,15 +787,16 @@ def process_healthcheck(service_dict):
|
||||||
if 'healthcheck' not in service_dict:
|
if 'healthcheck' not in service_dict:
|
||||||
return service_dict
|
return service_dict
|
||||||
|
|
||||||
if 'disable' in service_dict['healthcheck']:
|
hc = service_dict['healthcheck']
|
||||||
del service_dict['healthcheck']['disable']
|
|
||||||
service_dict['healthcheck']['test'] = ['NONE']
|
if 'disable' in hc:
|
||||||
|
del hc['disable']
|
||||||
|
hc['test'] = ['NONE']
|
||||||
|
|
||||||
for field in ['interval', 'timeout', 'start_period']:
|
for field in ['interval', 'timeout', 'start_period']:
|
||||||
if field in service_dict['healthcheck']:
|
if field not in hc or isinstance(hc[field], six.integer_types):
|
||||||
if not isinstance(service_dict['healthcheck'][field], six.integer_types):
|
continue
|
||||||
service_dict['healthcheck'][field] = parse_nanoseconds_int(
|
hc[field] = parse_nanoseconds_int(hc[field])
|
||||||
service_dict['healthcheck'][field])
|
|
||||||
|
|
||||||
return service_dict
|
return service_dict
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue