mirror of
https://github.com/dragonheim/gagent.git
synced 2025-04-26 08:08:58 -07: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
|
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.
|
||||||
|
|
|
@ -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() {
|
||||||
|
@ -108,7 +109,7 @@ func main() {
|
||||||
err := hclsimple.DecodeFile(configFile, nil, &config)
|
err := hclsimple.DecodeFile(configFile, nil, &config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to load configuration file: %s.\n", configFile)
|
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"])
|
os.Exit(exitCodes.m["CONFIG_FILE_MISSING"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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"])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue