19166: Pass GatewayAuthSecret to crunch-run through lsf/slurm.
[arvados.git] / services / crunch-dispatch-slurm / script.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package dispatchslurm
6
7 import (
8         "strings"
9 )
10
11 func execScript(args []string, env map[string]string) string {
12         s := "#!/bin/sh\n"
13         for k, v := range env {
14                 s += k + `='`
15                 s += strings.Replace(v, `'`, `'\''`, -1)
16                 s += `' `
17         }
18         s += `exec`
19         for _, w := range args {
20                 s += ` '`
21                 s += strings.Replace(w, `'`, `'\''`, -1)
22                 s += `'`
23         }
24         return s + "\n"
25 }