Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run command inside sh c local run #159

Merged
merged 2 commits into from
Jan 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion paasta_tools/cli/cmds/local_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ def get_docker_run_cmd(memory, random_port, container_name, volumes, env, intera
cmd.append('--detach=true')
cmd.append('%s' % docker_hash)
if command:
cmd.extend(command)
cmd.extend((
'sh', '-c',
' '.join(pipes.quote(part) for part in command)
))
return cmd


Expand Down
3 changes: 2 additions & 1 deletion tests/cli/test_cmds_local_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import docker
import mock
import pipes
from pytest import raises

from paasta_tools.marathon_tools import MarathonServiceConfig
Expand Down Expand Up @@ -433,7 +434,7 @@ def test_get_docker_run_cmd_interactive_false():
assert '--interactive=true' not in actual
assert '--tty=true' not in actual
assert docker_hash in actual
assert all([arg in actual for arg in command])
assert ' '.join(pipes.quote(part) for part in command) in actual


def test_get_docker_run_cmd_interactive_true():
Expand Down