1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

removed debug print statements

This commit is contained in:
postmannen 2021-09-23 05:46:25 +02:00
parent dc10757e62
commit e33fba19e1
7 changed files with 7 additions and 21 deletions

View file

@ -241,7 +241,7 @@ Steward supports both the use of flags/arguments set at startup, and the use of
- A default config file will be created at first startup if one does not exist
- The default config will contain default values.
- Any value also provided via a flag will also be written to the config file.
- If **Steward** is restarted, the current content of the config file will be used as the new defaults.
- If **Steward** is restarted, the current content of the config file will be used as the new defaults.
- If you restart Steward without any flags specified, the values of the last run will be read from the config file.
- If new values are provided via CLI flags, they will take **precedence** over the ones currently in the config file.
- The new CLI flag values will be written to the config, making it the default for the next restart.
@ -322,7 +322,7 @@ Stop a process. Takes the REQ method, receiving node name, kind publisher/subscr
#### REQCliCommand
Run CLI command on a node. Linux/Windows/Mac/Docker-container or other.
Run CLI command on a node. Linux/Windows/Mac/Docker-container or other.
Will run the command given, and return the stdout output of the command when the command is done.
@ -541,7 +541,7 @@ Steward is written in go, so you need Go installed to compile it. You can get go
- Clone the repository:
- `git clone https://github.com/RaaLabs/steward.git`.
- Change directory and build:
- `cd ./steward/cmd`
- `cd ./steward/cmd`
- `go build -o steward`
- Run the application with `env CONFIG_FOLDER </myconfig/folder/here> ./steward`
@ -981,7 +981,7 @@ You can save the content to myfile.JSON and append it to the `socket` file:
Description of the differences are mentioned earlier.
Info: The command/event called **MessageType** are present in both the **Subject** structure and the **Message** structure.
Info: The command/event called **MessageType** are present in both the **Subject** structure and the **Message** structure.
This is due to MessageType being used in both the naming of a subject, and for specifying message type to allow for specific processing of a message.
**Method**: Are the functionality the message provide. Example could be `CLICommand` or `Syslogforwarding`

View file

@ -1,7 +1,6 @@
package main
import (
"fmt"
"log"
"net/http"
"os"
@ -54,7 +53,7 @@ func main() {
// Block and wait for CTRL+C
sig := <-sigCh
fmt.Printf("Got exit signal, terminating all processes, %v\n", sig)
log.Printf("Got exit signal, terminating all processes, %v\n", sig)
// Adding a safety function here so we can make sure that all processes
// are stopped after a given time if the context cancelation hangs.

View file

@ -147,7 +147,6 @@ func (p *processes) Start(proc process) {
// Stop all subscriber processes.
func (p *processes) Stop() {
log.Printf("info: canceling all subscriber processes...\n")
fmt.Printf("* DEBUG: %v\n", p.wg)
p.cancel()
p.wg.Wait()
log.Printf("info: done canceling all subscriber processes.\n")

View file

@ -261,7 +261,6 @@ func (s *server) checkMessageToNodes(MsgSlice []Message) []Message {
// if toNodes specified, we use the original message, and
// create new node messages for each of the nodes specified.
case len(v.ToNodes) != 0:
fmt.Printf("\n * Found TonNodes: %#v\n\n", len(v.ToNodes))
for _, n := range v.ToNodes {
m := v
// Set the toNodes field to nil since we're creating

View file

@ -270,9 +270,6 @@ func newReplyMessage(proc process, message Message, outData []byte) {
message.ReplyMethod = REQToFileAppend
}
fmt.Printf("\n * DEBUG * newReplyMessage: message.FromNode contains: %v\n", message.FromNode)
fmt.Printf("\n * DEBUG * newReplyMessage: message.ToNode contains: %v\n", message.ToNode)
// Create a new message for the reply, and put it on the
// ringbuffer to be published.
newMsg := Message{
@ -638,7 +635,6 @@ func (m methodREQOpProcessStop) handler(proc process, message Message, node stri
// that publisher processes are named by the node they are sending the
// message to. Subscriber processes names are named by the node name
// they are running on.
fmt.Printf(" * DEBUG : %v\n", message.MethodArgs)
methodString := message.MethodArgs[0]
node := message.MethodArgs[1]
kind := message.MethodArgs[2]
@ -668,9 +664,7 @@ func (m methodREQOpProcessStop) handler(proc process, message Message, node stri
// We can then use this processName to get the real values for the
// actual process we want to stop.
sub := newSubject(method, string(node))
fmt.Printf(" * DEBUG : sub: %v\n", sub)
processName := processNameGet(sub.name(), processKind(kind))
fmt.Printf(" * DEBUG : processName: %v\n", processName)
proc.processes.mu.Lock()
@ -1075,8 +1069,6 @@ func (m methodREQCliCommand) handler(proc process, message Message, node string)
go func() {
defer proc.processes.wg.Done()
fmt.Printf("* DEBUG * handler: received message contains : %#v\n", message)
c := message.MethodArgs[0]
a := message.MethodArgs[1:]
@ -1110,7 +1102,6 @@ func (m methodREQCliCommand) handler(proc process, message Message, node string)
if foundEnvData {
envData = fmt.Sprintf("STEWARD_DATA=%v", envData)
cmd.Env = append(cmd.Env, envData)
fmt.Printf("\n * DEBUG * cmd.Env contains: %v\n\n", cmd.Env)
}
var out bytes.Buffer
@ -1174,7 +1165,6 @@ func (m methodREQToConsole) getKind() CommandOrEvent {
// Handler to write directly to console.
func (m methodREQToConsole) handler(proc process, message Message, node string) ([]byte, error) {
fmt.Printf("<--- methodCLICommandReply: %v\n", message.Data)
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
return ackMsg, nil
@ -1483,7 +1473,7 @@ func (m methodREQToSocket) getKind() CommandOrEvent {
func (m methodREQToSocket) handler(proc process, message Message, node string) ([]byte, error) {
for _, d := range message.Data {
// Write the data to the socket here.
// TODO: Write the data to the socket here.
fmt.Printf("Info: Data to write to socket: %v\n", d)
}

View file

@ -165,7 +165,6 @@ func (r *ringBuffer) fillBuffer(ctx context.Context, inCh chan subjectAndMessage
er := fmt.Errorf("error: fillBuffer: the event or command type do not exist, so this message will not be put on the buffer to be processed. Check the syntax used in the json file for the message. Allowed values are : %v, where given: coe=%v, with subject=%v", coeAvailableValues, v.CommandOrEvent, v.Subject)
sendErrorLogMessage(r.configuration, r.metrics, r.newMessagesCh, Node(r.nodeName), er)
fmt.Println()
// if it was not a valid value, we jump back up, and
// continue the range iteration.
continue

View file

@ -197,7 +197,7 @@ func NewServer(c *Configuration, version string) (*server, error) {
// if there is publisher process for a given message subject, and
// if it does not exist it will spawn one.
func (s *server) Start() {
fmt.Printf(" * VERSION = %+v\n", s.version)
log.Printf("Starting steward, version=%+v\n", s.version)
s.metrics.promVersion.With(prometheus.Labels{"version": string(s.version)})
// Start the error kernel that will do all the error handling