Skip to content

Commit ac26eb7

Browse files
author
Gabriel Monroy
committed
update App.run for docker 0.7 and slugrunner syntax
1 parent 9f18138 commit ac26eb7

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

api/models.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ def logs(self):
531531

532532
def run(self, command):
533533
"""Run a one-off command in an ephemeral app container."""
534+
# TODO: add support for interactive shell
534535
nodes = self.formation.node_set.filter(layer__runtime=True).order_by('?')
535536
if not nodes:
536537
raise EnvironmentError('No nodes available to run command')
@@ -539,12 +540,9 @@ def run(self, command):
539540
# prepare ssh command
540541
version = release.version
541542
docker_args = ' '.join(
542-
['-v',
543-
'/opt/deis/runtime/slugs/{app_id}-{version}/app:/app'.format(**locals()),
544-
release.build.image])
545-
base_cmd = "export HOME=/app; cd /app && for profile in " \
546-
"`find /app/.profile.d/*.sh -type f`; do . $profile; done"
547-
command = "/bin/sh -c '{base_cmd} && {command}'".format(**locals())
543+
['-a', 'stdout', '-a', 'stderr',
544+
'-v', '/opt/deis/runtime/slugs/{app_id}-v{version}:/app'.format(**locals()),
545+
'deis/slugrunner'])
548546
command = "sudo docker run {docker_args} {command}".format(**locals())
549547
return node.run(command)
550548

0 commit comments

Comments
 (0)