fix: (issues/7): Client is now correctly loading the agent.

This commit is contained in:
James Wells 2021-04-03 13:27:18 -07:00
parent 17b097b1b7
commit 8bb01d0266
Signed by: jwells
GPG key ID: 73196D10B8E65666
2 changed files with 9 additions and 3 deletions

View file

@ -25,10 +25,11 @@ Imagine, for a moment, that you are on Mars and need to perform a search for dat
``` ```
Lines 1 - 3 are simple comments Lines 1 - 3 are simple comments
Line 4 Tells the G'Agent router that this is the start of the hints to route for. Line 4 indicates the start of the hints.
Lines 5 - 7 are a list of hints that the router will use to determine which router(s) may have domain specific information. Lines 5 - 7 are a list of hints that the router will use to determine which router(s) may have domain specific information.
Line 8 indicates the end of the hints.
Lines 9 - 11 are a tcl procedure that will be executed on the worker before sending the results back to the client. Lines 9 - 11 are a tcl procedure that will be executed on the worker before sending the results back to the client.
Line 12 executes the procedure defined above. Line 12 executes the procedure defined above.

View file

@ -31,6 +31,7 @@ var exitCodes = struct {
"AGENT_MISSING_TAGS": 5, "AGENT_MISSING_TAGS": 5,
"NO_ROUTERS_DEFINED": 6, "NO_ROUTERS_DEFINED": 6,
"NO_WORKERS_DEFINED": 7, "NO_WORKERS_DEFINED": 7,
"AGENT_NOT_DEFINED": 8,
}} }}
func main() { func main() {
@ -125,6 +126,10 @@ func main() {
log.Printf("Arguments are %v\n", arguments) log.Printf("Arguments are %v\n", arguments)
log.Printf("Configuration is %v\n", config) log.Printf("Configuration is %v\n", config)
log.Printf("Running in client mode\n") log.Printf("Running in client mode\n")
if arguments["--agent"] == nil {
log.Printf("Agent file not specified")
os.Exit(exitCodes.m["AGENT_NOT_DEFINED"])
}
agent, err := ioutil.ReadFile(arguments["--agent"].(string)) agent, err := ioutil.ReadFile(arguments["--agent"].(string))
if err == nil { if err == nil {
log.Printf("Agent containts %v\n", string(agent)) log.Printf("Agent containts %v\n", string(agent))
@ -133,7 +138,7 @@ func main() {
log.Printf("Forked thread has completed\n") log.Printf("Forked thread has completed\n")
time.Sleep(10 * time.Second) time.Sleep(10 * time.Second)
} else { } else {
log.Printf("Failed to load Agent file: %s.\n", arguments["--agent"].(string)) log.Printf("Failed to load Agent file: %s", arguments["--agent"])
os.Exit(exitCodes.m["AGENT_LOAD_FAILED"]) os.Exit(exitCodes.m["AGENT_LOAD_FAILED"])
} }