Skip to content
Snippets Groups Projects
Commit f131c407 authored by Benjamin Schubert's avatar Benjamin Schubert
Browse files

Merge branch 'bschubert/fix-command-sandbox' into 'master'

Check is command is a str and replace by list before checking existence

Closes #728

See merge request !898
parents 494d7018 80762ecb
No related branches found
No related tags found
Loading
Pipeline #34421657 passed
...@@ -66,15 +66,15 @@ class SandboxBwrap(Sandbox): ...@@ -66,15 +66,15 @@ class SandboxBwrap(Sandbox):
cwd = self._get_work_directory(cwd=cwd) cwd = self._get_work_directory(cwd=cwd)
env = self._get_environment(cwd=cwd, env=env) env = self._get_environment(cwd=cwd, env=env)
# Convert single-string argument to a list
if isinstance(command, str):
command = [command]
if not self._has_command(command[0], env): if not self._has_command(command[0], env):
raise SandboxError("Staged artifacts do not provide command " raise SandboxError("Staged artifacts do not provide command "
"'{}'".format(command[0]), "'{}'".format(command[0]),
reason='missing-command') reason='missing-command')
# We want command args as a list of strings
if isinstance(command, str):
command = [command]
# Create the mount map, this will tell us where # Create the mount map, this will tell us where
# each mount point needs to be mounted from and to # each mount point needs to be mounted from and to
mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY) mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY)
......
...@@ -57,15 +57,15 @@ class SandboxChroot(Sandbox): ...@@ -57,15 +57,15 @@ class SandboxChroot(Sandbox):
cwd = self._get_work_directory(cwd=cwd) cwd = self._get_work_directory(cwd=cwd)
env = self._get_environment(cwd=cwd, env=env) env = self._get_environment(cwd=cwd, env=env)
# Convert single-string argument to a list
if isinstance(command, str):
command = [command]
if not self._has_command(command[0], env): if not self._has_command(command[0], env):
raise SandboxError("Staged artifacts do not provide command " raise SandboxError("Staged artifacts do not provide command "
"'{}'".format(command[0]), "'{}'".format(command[0]),
reason='missing-command') reason='missing-command')
# Command must be a list
if isinstance(command, str):
command = [command]
stdout, stderr = self._get_output() stdout, stderr = self._get_output()
# Create the mount map, this will tell us where # Create the mount map, this will tell us where
......
...@@ -33,6 +33,10 @@ class SandboxDummy(Sandbox): ...@@ -33,6 +33,10 @@ class SandboxDummy(Sandbox):
cwd = self._get_work_directory(cwd=cwd) cwd = self._get_work_directory(cwd=cwd)
env = self._get_environment(cwd=cwd, env=env) env = self._get_environment(cwd=cwd, env=env)
# Convert single-string argument to a list
if isinstance(command, str):
command = [command]
if not self._has_command(command[0], env): if not self._has_command(command[0], env):
raise SandboxError("Staged artifacts do not provide command " raise SandboxError("Staged artifacts do not provide command "
"'{}'".format(command[0]), "'{}'".format(command[0]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment