Falsy values in COMPOSE_CONVERT_WINDOWS_PATHS are properly recognized
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
344f015a22
commit
de38c023ce
3 changed files with 52 additions and 1 deletions
|
|
@ -712,7 +712,7 @@ def finalize_service(service_config, service_names, version, environment):
|
|||
if 'volumes' in service_dict:
|
||||
service_dict['volumes'] = [
|
||||
VolumeSpec.parse(
|
||||
v, environment.get('COMPOSE_CONVERT_WINDOWS_PATHS')
|
||||
v, environment.get_boolean('COMPOSE_CONVERT_WINDOWS_PATHS')
|
||||
) for v in service_dict['volumes']
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -105,3 +105,14 @@ class Environment(dict):
|
|||
super(Environment, self).get(key.upper(), *args, **kwargs)
|
||||
)
|
||||
return super(Environment, self).get(key, *args, **kwargs)
|
||||
|
||||
def get_boolean(self, key):
|
||||
# Convert a value to a boolean using "common sense" rules.
|
||||
# Unset, empty, "0" and "false" (i-case) yield False.
|
||||
# All other values yield True.
|
||||
value = self.get(key)
|
||||
if not value:
|
||||
return False
|
||||
if value.lower() in ['0', 'false']:
|
||||
return False
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue