mirror of https://github.com/docker/compose.git
Remove `None` entries on execute command
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
parent
160b5c1755
commit
9f5f8b4757
|
@ -1466,7 +1466,12 @@ def call_docker(args, dockeropts, environment):
|
||||||
args = [executable_path] + tls_options + args
|
args = [executable_path] + tls_options + args
|
||||||
log.debug(" ".join(map(pipes.quote, args)))
|
log.debug(" ".join(map(pipes.quote, args)))
|
||||||
|
|
||||||
return subprocess.call(args, env=environment)
|
filtered_env = {}
|
||||||
|
for k, v in environment.items():
|
||||||
|
if v is not None:
|
||||||
|
filtered_env[k] = environment[k]
|
||||||
|
|
||||||
|
return subprocess.call(args, env=filtered_env)
|
||||||
|
|
||||||
|
|
||||||
def parse_scale_args(options):
|
def parse_scale_args(options):
|
||||||
|
|
|
@ -1711,6 +1711,17 @@ services:
|
||||||
assert stderr == ""
|
assert stderr == ""
|
||||||
assert stdout == "/\n"
|
assert stdout == "/\n"
|
||||||
|
|
||||||
|
@mock.patch.dict(os.environ)
|
||||||
|
def test_exec_novalue_var_dotenv_file(self):
|
||||||
|
os.environ['MYVAR'] = 'SUCCESS'
|
||||||
|
self.base_dir = 'tests/fixtures/exec-novalue-var'
|
||||||
|
self.dispatch(['up', '-d'])
|
||||||
|
assert len(self.project.containers()) == 1
|
||||||
|
|
||||||
|
stdout, stderr = self.dispatch(['exec', '-T', 'nginx', 'env'])
|
||||||
|
assert 'CHECK_VAR=SUCCESS' in stdout
|
||||||
|
assert not stderr
|
||||||
|
|
||||||
def test_exec_detach_long_form(self):
|
def test_exec_detach_long_form(self):
|
||||||
self.base_dir = 'tests/fixtures/links-composefile'
|
self.base_dir = 'tests/fixtures/links-composefile'
|
||||||
self.dispatch(['up', '--detach', 'console'])
|
self.dispatch(['up', '--detach', 'console'])
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
environment:
|
||||||
|
- CHECK_VAR=${MYVAR}
|
Loading…
Reference in New Issue