Refactoring some redundancies.

This commit is contained in:
Robert Tice
2019-04-01 12:17:07 -04:00
parent 3f03ca0ac9
commit 6397dd9301

View File

@@ -222,22 +222,18 @@ def run_program(request):
return CrossDomainResponse(result)
# Run the command(s) to check the program
run_cmd = "python /workspace/run.py /workspace/sessions/{} {}".format(
os.path.basename(tempd), mode)
if 'lab' in received_json:
lab = received_json['lab']
commands = [
run_cmd += " {}".format(lab)
commands = [
# Run the program
["lxc", "exec", "safecontainer", "--", "su", "runner",
"-c",
"python /workspace/run.py /workspace/sessions/{} {} {}".format(
os.path.basename(tempd), mode, lab)]
]
else:
commands = [
# Run the program
["lxc", "exec", "safecontainer", "--", "su", "runner",
"-c",
"python /workspace/run.py /workspace/sessions/{} {}".format(
os.path.basename(tempd), mode)]
run_cmd]
]
print "\n".join(" ".join(c) for c in commands)