mirror of
https://github.com/dragonheim/gagent.git
synced 2025-01-18 04:56:28 -08:00
fix: (issues/7): Client is now correctly loading the agent.
This commit is contained in:
parent
17b097b1b7
commit
8bb01d0266
2 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Line 12 executes the procedure defined above.
|
||||
|
|
|
@ -31,6 +31,7 @@ var exitCodes = struct {
|
|||
"AGENT_MISSING_TAGS": 5,
|
||||
"NO_ROUTERS_DEFINED": 6,
|
||||
"NO_WORKERS_DEFINED": 7,
|
||||
"AGENT_NOT_DEFINED": 8,
|
||||
}}
|
||||
|
||||
func main() {
|
||||
|
@ -108,7 +109,7 @@ func main() {
|
|||
err := hclsimple.DecodeFile(configFile, nil, &config)
|
||||
if err != nil {
|
||||
log.Printf("Failed to load configuration file: %s.\n", configFile)
|
||||
log.Printf("%s\n",err)
|
||||
log.Printf("%s\n", err)
|
||||
os.Exit(exitCodes.m["CONFIG_FILE_MISSING"])
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +126,10 @@ func main() {
|
|||
log.Printf("Arguments are %v\n", arguments)
|
||||
log.Printf("Configuration is %v\n", config)
|
||||
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))
|
||||
if err == nil {
|
||||
log.Printf("Agent containts %v\n", string(agent))
|
||||
|
@ -133,7 +138,7 @@ func main() {
|
|||
log.Printf("Forked thread has completed\n")
|
||||
time.Sleep(10 * time.Second)
|
||||
} 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"])
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue