mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
rewrote error handling for req acl's
This commit is contained in:
parent
e5a7ad3699
commit
fbbeb1a4ab
1 changed files with 96 additions and 114 deletions
210
requests_acl.go
210
requests_acl.go
|
@ -22,23 +22,21 @@ func (m methodREQAclAddCommand) handler(proc process, message Message, node stri
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 3:
|
|
||||||
er := fmt.Errorf("error: methodREQAclAddAccessList: got <3 number methodArgs, want 3")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 3:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclAddAccessList: got <3 number methodArgs, want 3")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
host := message.MethodArgs[0]
|
host := message.MethodArgs[0]
|
||||||
source := message.MethodArgs[1]
|
source := message.MethodArgs[1]
|
||||||
cmd := message.MethodArgs[2]
|
cmd := message.MethodArgs[2]
|
||||||
|
@ -56,14 +54,15 @@ func (m methodREQAclAddCommand) handler(proc process, message Message, node stri
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclAddAccessList: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclAddAccessList: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -93,23 +92,21 @@ func (m methodREQAclDeleteCommand) handler(proc process, message Message, node s
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 3:
|
|
||||||
er := fmt.Errorf("error: methodREQAclDeleteCommand: got <3 number methodArgs, want 3")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 3:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclDeleteCommand: got <3 number methodArgs, want 3")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
host := message.MethodArgs[0]
|
host := message.MethodArgs[0]
|
||||||
source := message.MethodArgs[1]
|
source := message.MethodArgs[1]
|
||||||
cmd := message.MethodArgs[2]
|
cmd := message.MethodArgs[2]
|
||||||
|
@ -127,14 +124,15 @@ func (m methodREQAclDeleteCommand) handler(proc process, message Message, node s
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclDeleteCommand: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclDeleteCommand: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -164,23 +162,21 @@ func (m methodREQAclDeleteSource) handler(proc process, message Message, node st
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 2:
|
|
||||||
er := fmt.Errorf("error: methodREQAclDeleteSource: got <2 number methodArgs, want 2")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 2:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclDeleteSource: got <2 number methodArgs, want 2")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
host := message.MethodArgs[0]
|
host := message.MethodArgs[0]
|
||||||
source := message.MethodArgs[1]
|
source := message.MethodArgs[1]
|
||||||
|
|
||||||
|
@ -197,14 +193,15 @@ func (m methodREQAclDeleteSource) handler(proc process, message Message, node st
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclDeleteSource: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclDeleteSource: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -234,23 +231,21 @@ func (m methodREQAclGroupNodesAddNode) handler(proc process, message Message, no
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 2:
|
|
||||||
er := fmt.Errorf("error: methodREQAclGroupNodesAddNode: got <2 number methodArgs, want 2")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 2:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclGroupNodesAddNode: got <2 number methodArgs, want 2")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ng := message.MethodArgs[0]
|
ng := message.MethodArgs[0]
|
||||||
n := message.MethodArgs[1]
|
n := message.MethodArgs[1]
|
||||||
|
|
||||||
|
@ -267,14 +262,15 @@ func (m methodREQAclGroupNodesAddNode) handler(proc process, message Message, no
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclGroupNodesAddNode: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclGroupNodesAddNode: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -304,23 +300,21 @@ func (m methodREQAclGroupNodesDeleteNode) handler(proc process, message Message,
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 2:
|
|
||||||
er := fmt.Errorf("error: methodREQAclGroupNodesDeleteNode: got <2 number methodArgs, want 2")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 2:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclGroupNodesDeleteNode: got <2 number methodArgs, want 2")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ng := message.MethodArgs[0]
|
ng := message.MethodArgs[0]
|
||||||
n := message.MethodArgs[1]
|
n := message.MethodArgs[1]
|
||||||
|
|
||||||
|
@ -337,14 +331,15 @@ func (m methodREQAclGroupNodesDeleteNode) handler(proc process, message Message,
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclGroupNodesDeleteNode: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclGroupNodesDeleteNode: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -374,23 +369,21 @@ func (m methodREQAclGroupNodesDeleteGroup) handler(proc process, message Message
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 1:
|
|
||||||
er := fmt.Errorf("error: methodREQAclGroupNodesDeleteGroup: got <1 number methodArgs, want 1")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 1:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclGroupNodesDeleteGroup: got <1 number methodArgs, want 1")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ng := message.MethodArgs[0]
|
ng := message.MethodArgs[0]
|
||||||
|
|
||||||
proc.centralAuth.accessLists.groupNodesDeleteGroup(nodeGroup(ng))
|
proc.centralAuth.accessLists.groupNodesDeleteGroup(nodeGroup(ng))
|
||||||
|
@ -406,14 +399,15 @@ func (m methodREQAclGroupNodesDeleteGroup) handler(proc process, message Message
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclGroupNodesDeleteGroup: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclGroupNodesDeleteGroup: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -443,23 +437,21 @@ func (m methodREQAclGroupCommandsAddCommand) handler(proc process, message Messa
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 2:
|
|
||||||
er := fmt.Errorf("error: methodREQAclGroupCommandsAddCommand: got <2 number methodArgs, want 1")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 2:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclGroupCommandsAddCommand: got <2 number methodArgs, want 1")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
cg := message.MethodArgs[0]
|
cg := message.MethodArgs[0]
|
||||||
c := message.MethodArgs[1]
|
c := message.MethodArgs[1]
|
||||||
|
|
||||||
|
@ -476,14 +468,15 @@ func (m methodREQAclGroupCommandsAddCommand) handler(proc process, message Messa
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclGroupCommandsAddCommand: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclGroupCommandsAddCommand: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -513,23 +506,21 @@ func (m methodREQAclGroupCommandsDeleteCommand) handler(proc process, message Me
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 1:
|
|
||||||
er := fmt.Errorf("error: methodREQAclGroupCommandsDeleteCommand: got <1 number methodArgs, want 1")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 1:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclGroupCommandsDeleteCommand: got <1 number methodArgs, want 1")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
cg := message.MethodArgs[0]
|
cg := message.MethodArgs[0]
|
||||||
c := message.MethodArgs[1]
|
c := message.MethodArgs[1]
|
||||||
|
|
||||||
|
@ -546,14 +537,15 @@ func (m methodREQAclGroupCommandsDeleteCommand) handler(proc process, message Me
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclGroupCommandsDeleteCommand: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclGroupCommandsDeleteCommand: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -583,23 +575,21 @@ func (m methodREQAclGroupCommandsDeleteGroup) handler(proc process, message Mess
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 1:
|
|
||||||
er := fmt.Errorf("error: methodREQAclGroupCommandsDeleteGroup: got <1 number methodArgs, want 1")
|
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
|
errCh := make(chan error)
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 1:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclGroupCommandsDeleteGroup: got <1 number methodArgs, want 1")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
cg := message.MethodArgs[0]
|
cg := message.MethodArgs[0]
|
||||||
|
|
||||||
proc.centralAuth.accessLists.groupCommandDeleteGroup(commandGroup(cg))
|
proc.centralAuth.accessLists.groupCommandDeleteGroup(commandGroup(cg))
|
||||||
|
@ -615,14 +605,15 @@ func (m methodREQAclGroupCommandsDeleteGroup) handler(proc process, message Mess
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case err := <-errCh:
|
||||||
|
proc.errorKernel.errSend(proc, message, err)
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
er := fmt.Errorf("error: methodREQAclGroupCommandsDeleteGroup: method timed out: %v", message.MethodArgs)
|
er := fmt.Errorf("error: methodREQAclGroupCommandsDeleteGroup: method timed out: %v", message.MethodArgs)
|
||||||
proc.errorKernel.errSend(proc, message, er)
|
proc.errorKernel.errSend(proc, message, er)
|
||||||
|
|
||||||
case out := <-outCh:
|
case out := <-outCh:
|
||||||
|
|
||||||
// Prepare and queue for sending a new message with the output
|
// Prepare and queue for sending a new message with the output
|
||||||
// of the action executed.
|
// of the action executed.
|
||||||
newReplyMessage(proc, message, out)
|
newReplyMessage(proc, message, out)
|
||||||
|
@ -652,17 +643,8 @@ func (m methodREQAclExport) handler(proc process, message Message, node string)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
// switch {
|
|
||||||
// case len(message.MethodArgs) < 1:
|
|
||||||
// er := fmt.Errorf("error: methodREQAclImport: got <1 number methodArgs, want 1")
|
|
||||||
// proc.errorKernel.errSend(proc, message, er)
|
|
||||||
//
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
ctx, cancel := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
errCh := make(chan error)
|
errCh := make(chan error)
|
||||||
|
|
||||||
|
@ -731,16 +713,16 @@ func (m methodREQAclImport) handler(proc process, message Message, node string)
|
||||||
outCh := make(chan []byte)
|
outCh := make(chan []byte)
|
||||||
errCh := make(chan error)
|
errCh := make(chan error)
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(message.MethodArgs) < 1:
|
|
||||||
errCh <- fmt.Errorf("error: methodREQAclImport: got <1 number methodArgs, want 1")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
proc.processes.wg.Add(1)
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer proc.processes.wg.Done()
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case len(message.MethodArgs) < 1:
|
||||||
|
errCh <- fmt.Errorf("error: methodREQAclImport: got <1 number methodArgs, want 1")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
js := []byte(message.MethodArgs[0])
|
js := []byte(message.MethodArgs[0])
|
||||||
err := proc.centralAuth.accessLists.importACLs(js)
|
err := proc.centralAuth.accessLists.importACLs(js)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue