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

@ -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:]