mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
refactor(agent): update version handling in AgentConfig to use pkg.Version type
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
|||||||
type AgentConfig struct {
|
type AgentConfig struct {
|
||||||
Addr string `json:"addr"`
|
Addr string `json:"addr"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Version string `json:"version"`
|
Version pkg.Version `json:"version"`
|
||||||
Runtime ContainerRuntime `json:"runtime"`
|
Runtime ContainerRuntime `json:"runtime"`
|
||||||
|
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
@@ -148,11 +148,10 @@ func (cfg *AgentConfig) StartWithCerts(ctx context.Context, ca, crt, key []byte)
|
|||||||
return fmt.Errorf("failed to get agent runtime: HTTP %d %s", status, runtimeBytes)
|
return fmt.Errorf("failed to get agent runtime: HTTP %d %s", status, runtimeBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Version = string(agentVersionBytes)
|
cfg.Version = pkg.ParseVersion(string(agentVersionBytes))
|
||||||
agentVersion := pkg.ParseVersion(cfg.Version)
|
|
||||||
|
|
||||||
if serverVersion.IsNewerMajorThan(agentVersion) {
|
if serverVersion.IsNewerThanMajor(cfg.Version) {
|
||||||
log.Warn().Msgf("agent %s major version mismatch: server: %s, agent: %s", cfg.Name, serverVersion, agentVersion)
|
log.Warn().Msgf("agent %s major version mismatch: server: %s, agent: %s", cfg.Name, serverVersion, cfg.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Msgf("agent %q initialized", cfg.Name)
|
log.Info().Msgf("agent %q initialized", cfg.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user