mirror of https://github.com/docker/docker-py.git
Fix env vars with empty values.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
507503cdfa
commit
3bad04649d
|
@ -823,7 +823,7 @@ def split_command(command):
|
|||
|
||||
def format_environment(environment):
|
||||
def format_env(key, value):
|
||||
if not value:
|
||||
if value is None:
|
||||
return key
|
||||
return '{key}={value}'.format(key=key, value=value)
|
||||
return [format_env(*var) for var in six.iteritems(environment)]
|
||||
|
|
|
@ -374,11 +374,14 @@ class CreateContainerTest(helpers.BaseTestCase):
|
|||
container = self.client.create_container(
|
||||
BUSYBOX,
|
||||
['echo'],
|
||||
environment={'Foo': None, 'Other': 'one'},
|
||||
environment={'Foo': None, 'Other': 'one', 'Blank': ''},
|
||||
)
|
||||
self.tmp_containers.append(container['Id'])
|
||||
config = self.client.inspect_container(container['Id'])
|
||||
assert sorted(config['Config']['Env']) == sorted(['Foo', 'Other=one'])
|
||||
assert (
|
||||
sorted(config['Config']['Env']) ==
|
||||
sorted(['Foo', 'Other=one', 'Blank='])
|
||||
)
|
||||
|
||||
|
||||
class VolumeBindTest(helpers.BaseTestCase):
|
||||
|
|
Loading…
Reference in New Issue