19166: Pass GatewayAuthSecret to crunch-run through lsf/slurm.
[arvados.git] / services / crunch-dispatch-slurm / script.go
index fb16e593e5c5648720452fd49194910a4b2021b5..d0bfbc4a929dd8067a8e3e3e519b17dc0777f475 100644 (file)
@@ -8,8 +8,14 @@ import (
        "strings"
 )
 
-func execScript(args []string) string {
-       s := "#!/bin/sh\nexec"
+func execScript(args []string, env map[string]string) string {
+       s := "#!/bin/sh\n"
+       for k, v := range env {
+               s += k + `='`
+               s += strings.Replace(v, `'`, `'\''`, -1)
+               s += `' `
+       }
+       s += `exec`
        for _, w := range args {
                s += ` '`
                s += strings.Replace(w, `'`, `'\''`, -1)