Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
allgo
allgo
Commits
e8b721ce
Commit
e8b721ce
authored
Feb 09, 2017
by
BAIRE Anthony
Browse files
restart the sandboxes if interrupted
(+ quote w/ shlex)
parent
1c3a00f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
docker/controller.py
View file @
e8b721ce
...
...
@@ -511,7 +511,7 @@ class SandboxManager(Manager):
# FIXME: do nothing if entrypoint already exists
command
=
[
"/bin/sh"
,
"-c"
,
"""
{mkdir}
cat > {entrypoint
!r
} <<EOF
test -f {entrypoint} ||
cat > {entrypoint} <<EOF
#!/bin/sh
echo
echo "This is app '{name}' called with parameters '\$@'"
...
...
@@ -519,12 +519,12 @@ echo
echo "The workdir contains:"
ls -l
EOF
chmod 0755 -- {entrypoint
!r
}
chmod 0755 -- {entrypoint}
exec {cmd}
"""
.
format
(
entrypoint
=
webapp
.
entrypoint
,
"""
.
format
(
entrypoint
=
shlex
.
quote
(
webapp
.
entrypoint
)
,
name
=
webapp
.
docker_name
,
mkdir
=
((
"mkdir -p -- %
r
"
%
dn
)
if
dn
else
""
),
cmd
=
" "
.
join
(
map
(
repr
,
command
)))]
mkdir
=
((
"mkdir -p -- %
s
"
%
shlex
.
quote
(
dn
)
)
if
dn
else
""
),
cmd
=
" "
.
join
(
map
(
shlex
.
quote
,
command
)))]
ctrl
.
sandbox
.
create_container
(
image
,
name
=
container
,
hostname
=
container
,
command
=
command
,
...
...
@@ -535,6 +535,7 @@ EOF
},
# TODO: maybe drop other caps
cap_drop
=
[
"NET_RAW"
],
restart_policy
=
{
"Name"
:
"unless-stopped"
},
))
ctrl
.
sandbox
.
start
(
container
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment