Reject blank worker names and probe the real credential and venv in --check
This commit is contained in:
@@ -58,7 +58,17 @@ func main() {
|
||||
fmt.Println("check: no coordinator URL (pass --coordinator-url or set COORDINATOR_URL)")
|
||||
os.Exit(1)
|
||||
}
|
||||
report := agent.RunCheck(ctx, url, "")
|
||||
// Probe the managed venv when the wizard has installed it: workloads
|
||||
// run with that interpreter, so checking the bare system python3
|
||||
// would report a false negative.
|
||||
checkPython, checkToken, checkKey, checkUsers := "", "", "", ""
|
||||
if configPath := checkConfigPath(); configPath != "" {
|
||||
checkPython = agent.VenvPython(configPath)
|
||||
if config, err := agent.LoadConfigFile(configPath); err == nil {
|
||||
checkToken, checkKey, checkUsers = config.Token, config.WorkerKey, config.UserserviceURL
|
||||
}
|
||||
}
|
||||
report := agent.RunCheck(ctx, url, checkPython, checkToken, checkKey, checkUsers)
|
||||
printCheck(report)
|
||||
if !report.Coordinator.OK || !report.Python.OK || !report.Scimesh.OK {
|
||||
os.Exit(1)
|
||||
@@ -87,6 +97,15 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// checkConfigPath resolves where the wizard's config would be, honouring
|
||||
// SCIMESH_WORKER_CONFIG like the rest of the agent.
|
||||
func checkConfigPath() string {
|
||||
if env := os.Getenv("SCIMESH_WORKER_CONFIG"); env != "" {
|
||||
return env
|
||||
}
|
||||
return agent.DefaultConfigPath()
|
||||
}
|
||||
|
||||
// loadConfig prefers a --config file; environment variables override the file
|
||||
// (see agent.ConfigFile.Config). Without a file, the plain environment path is
|
||||
// used exactly as before.
|
||||
|
||||
Reference in New Issue
Block a user