mirror of
https://github.com/postmannen/ctrl.git
synced 2025-01-18 13:49:29 +00:00
initial checking for checking for {{data}}
This commit is contained in:
parent
5000d58630
commit
dcbe51a191
2 changed files with 16 additions and 1 deletions
15
requests.go
15
requests.go
|
@ -45,6 +45,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hpcloud/tail"
|
"github.com/hpcloud/tail"
|
||||||
|
@ -1067,6 +1068,20 @@ func (m methodREQCliCommand) handler(proc process, message Message, node string)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
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]
|
c := message.MethodArgs[0]
|
||||||
a := message.MethodArgs[1:]
|
a := message.MethodArgs[1:]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue