1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-03-05 14:56:49 +00:00

removed remains of allowednodes

This commit is contained in:
postmannen 2021-11-16 11:18:59 +01:00
parent 883f824325
commit 215a4ffd19
4 changed files with 3 additions and 41 deletions

View file

@ -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,

View file

@ -8,8 +8,7 @@
"operation":{
"opCmd":"startProc",
"opArg": {
"method": "REQHttpGet",
"allowedNodes": ["central","node1"]
"method": "REQHttpGet"
}
},
"replyMethod":"REQToFileAppend",

View file

@ -350,7 +350,6 @@ func (m methodREQOpCommand) getKind() CommandOrEvent {
type OpCmdStartProc struct {
Method Method `json:"method"`
AllowedNodes []Node `json:"allowedNodes"`
}
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)

View file

@ -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)
}