1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-04-09 10:24:17 +00:00

renamed OpCommandRequest to REQOpCommand

This commit is contained in:
postmannen 2021-04-04 07:55:07 +02:00
parent 9a5e37687f
commit 5cb3aab412
3 changed files with 8 additions and 8 deletions

View file

@ -3,7 +3,7 @@
"label":"opcommand_logs",
"toNode": "ship1",
"data": ["ps"],
"method":"OpCommandRequest",
"method":"REQOpCommand",
"timeout":3,
"retries":3,
"requestTimeout":3,

View file

@ -13,8 +13,8 @@ func (s *server) ProcessesStart() {
// --- Subscriber services that can be started via flags
{
fmt.Printf("Starting OpCommandRequest subscriber: %#v\n", s.nodeName)
sub := newSubject(OpCommandRequest, s.nodeName)
fmt.Printf("Starting REQOpCommand subscriber: %#v\n", s.nodeName)
sub := newSubject(REQOpCommand, s.nodeName)
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, []node{"*"}, nil)
go proc.spawnWorker(s)
}

View file

@ -51,7 +51,7 @@ type Method string
// when specifying what kind of Method to send or work with.
const (
// Command for client operation request of the system
OpCommandRequest Method = "OpCommandRequest"
REQOpCommand Method = "REQOpCommand"
// Execute a CLI command in for example bash or cmd.
// This is an event type, where a message will be sent to a
// node with the command to execute and an ACK will be replied
@ -113,7 +113,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
// Event, Used to communicate that an action has been performed.
ma := MethodsAvailable{
methodhandlers: map[Method]methodHandler{
OpCommandRequest: methodOpCommandRequest{
REQOpCommand: methodREQOpCommand{
commandOrEvent: CommandACK,
},
CLICommandRequest: methodCLICommandRequest{
@ -188,18 +188,18 @@ type methodHandler interface {
// -----
type methodOpCommandRequest struct {
type methodREQOpCommand struct {
commandOrEvent CommandOrEvent
}
func (m methodOpCommandRequest) getKind() CommandOrEvent {
func (m methodREQOpCommand) getKind() CommandOrEvent {
return m.commandOrEvent
}
// handler to run a CLI command with timeout context. The handler will
// return the output of the command run back to the calling publisher
// in the ack message.
func (m methodOpCommandRequest) handler(proc process, message Message, node string) ([]byte, error) {
func (m methodREQOpCommand) handler(proc process, message Message, node string) ([]byte, error) {
go func() {
out := []byte{}