mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-05 06:46:48 +00:00
removed remains of allowednodes
This commit is contained in:
parent
883f824325
commit
215a4ffd19
4 changed files with 3 additions and 41 deletions
|
@ -1005,8 +1005,7 @@ The API for sending a message from one node to another node is by sending a stru
|
|||
"operation":{
|
||||
"opCmd":"startProc",
|
||||
"opArg": {
|
||||
"method": "REQHttpGet",
|
||||
"allowedNodes": ["central","node1"]
|
||||
"method": "REQHttpGet"
|
||||
}
|
||||
},
|
||||
"ACKTimeout":3,
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
"operation":{
|
||||
"opCmd":"startProc",
|
||||
"opArg": {
|
||||
"method": "REQHttpGet",
|
||||
"allowedNodes": ["central","node1"]
|
||||
"method": "REQHttpGet"
|
||||
}
|
||||
},
|
||||
"replyMethod":"REQToFileAppend",
|
||||
|
|
10
requests.go
10
requests.go
|
@ -349,8 +349,7 @@ func (m methodREQOpCommand) getKind() CommandOrEvent {
|
|||
}
|
||||
|
||||
type OpCmdStartProc struct {
|
||||
Method Method `json:"method"`
|
||||
AllowedNodes []Node `json:"allowedNodes"`
|
||||
Method Method `json:"method"`
|
||||
}
|
||||
|
||||
type OpCmdStopProc struct {
|
||||
|
@ -406,13 +405,6 @@ func (m methodREQOpCommand) handler(proc process, message Message, nodeName stri
|
|||
// Assert it into the correct non pointer value.
|
||||
arg := *dst.(*OpCmdStartProc)
|
||||
|
||||
if len(arg.AllowedNodes) == 0 {
|
||||
er := fmt.Errorf("error: startProc: no allowed publisher nodes specified: %v" + fmt.Sprint(message))
|
||||
sendErrorLogMessage(proc.configuration, proc.processes.metrics, proc.toRingbufferCh, proc.node, er)
|
||||
log.Printf("%v\n", er)
|
||||
return
|
||||
}
|
||||
|
||||
if arg.Method == "" {
|
||||
er := fmt.Errorf("error: startProc: no method specified: %v" + fmt.Sprint(message))
|
||||
sendErrorLogMessage(proc.configuration, proc.processes.metrics, proc.toRingbufferCh, proc.node, er)
|
||||
|
|
|
@ -191,12 +191,6 @@ func messageSlide(app *tview.Application) tview.Primitive {
|
|||
item.SetLabel(label).SetOptions(values, nil).SetLabelWidth(25)
|
||||
formItems = append(formItems, formItem{label: label, formItem: item})
|
||||
}
|
||||
{
|
||||
label := "startProc AllowedNodes"
|
||||
item := tview.NewInputField()
|
||||
item.SetLabel(label).SetFieldWidth(30).SetLabelWidth(25)
|
||||
formItems = append(formItems, formItem{label: label, formItem: item})
|
||||
}
|
||||
|
||||
return formItems
|
||||
}()
|
||||
|
@ -404,29 +398,7 @@ func messageSlide(app *tview.Application) tview.Primitive {
|
|||
return
|
||||
}
|
||||
opCmdStartProc.Method = steward.Method(value)
|
||||
case "startProc AllowedNodes":
|
||||
// Split the comma separated string into a
|
||||
// and remove the start and end ampersand.
|
||||
sp := strings.Split(value, ",")
|
||||
|
||||
var allowedNodes []steward.Node
|
||||
|
||||
for _, v := range sp {
|
||||
// Check if format is correct, return if not.
|
||||
pre := strings.HasPrefix(v, "\"") || !strings.HasPrefix(v, ",") || !strings.HasPrefix(v, "\",") || !strings.HasPrefix(v, ",\"")
|
||||
suf := strings.HasSuffix(v, "\"")
|
||||
if !pre || !suf {
|
||||
fmt.Fprintf(p.logForm, "%v : error: malformed format for command, should be \"cmd\",\"arg1\",\"arg2\" ...\n", time.Now().Format("Mon Jan _2 15:04:05 2006"))
|
||||
return
|
||||
}
|
||||
// Remove leading and ending ampersand.
|
||||
v = v[1:]
|
||||
v = strings.TrimSuffix(v, "\"")
|
||||
|
||||
allowedNodes = append(allowedNodes, steward.Node(v))
|
||||
}
|
||||
|
||||
opCmdStartProc.AllowedNodes = allowedNodes
|
||||
default:
|
||||
fmt.Fprintf(p.logForm, "%v : error: did not find case defenition for how to handle the \"%v\" within the switch statement\n", time.Now().Format("Mon Jan _2 15:04:05 2006"), label)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue