1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

initial checking for checking for {{data}}

This commit is contained in:
postmannen 2021-09-21 23:19:55 +02:00
parent 5000d58630
commit dcbe51a191
2 changed files with 16 additions and 1 deletions

View file

@ -239,7 +239,7 @@ Steward supports both the use of flags/arguments set at startup, and the use of
- A default config file will be created at first startup if one does not exist
- The default config will contain default values.
- Any value also provided via a flag will also be written to the config file.
- Any value also provided via a flag will also be written to the config file.
- If **Steward** is restarted, the current content of the config file will be used as the new defaults.
- If you restart Steward without any flags specified, the values of the last run will be read from the config file.
- If new values are provided via CLI flags, they will take **precedence** over the ones currently in the config file.

View file

@ -45,6 +45,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/hpcloud/tail"
@ -1067,6 +1068,20 @@ func (m methodREQCliCommand) handler(proc process, message Message, node string)
go func() {
defer proc.processes.wg.Done()
// Check if {{data}} is defined in the arguments. If found put the
// data payload there.
for i, v := range message.MethodArgs {
if strings.Contains(v, "{{data}}") {
var s string
for _, vv := range message.Data {
s = s + vv
}
message.MethodArgs[i] = s
}
}
c := message.MethodArgs[0]
a := message.MethodArgs[1:]