From 6911497a63c92c3919d7ec97f433cc5ffb51ffe3 Mon Sep 17 00:00:00 2001 From: Sam Broughton Date: Thu, 22 Mar 2018 10:20:07 +0000 Subject: [PATCH] Log daemon version on startup This also changes the key used when printing the latest flux version, as reported by checkpoint, to make it less confusing to read. --- cmd/fluxd/checkpoint.go | 4 ++-- cmd/fluxd/main.go | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/fluxd/checkpoint.go b/cmd/fluxd/checkpoint.go index 207e40906..a597ab6b9 100644 --- a/cmd/fluxd/checkpoint.go +++ b/cmd/fluxd/checkpoint.go @@ -18,10 +18,10 @@ func checkForUpdates(clusterString string, gitString string, logger log.Logger) return } if r.Outdated { - logger.Log("msg", "update available", "version", r.CurrentVersion, "URL", r.CurrentDownloadURL) + logger.Log("msg", "update available", "latest", r.CurrentVersion, "URL", r.CurrentDownloadURL) return } - logger.Log("msg", "up to date", "version", r.CurrentVersion) + logger.Log("msg", "up to date", "latest", r.CurrentVersion) } flags := map[string]string{ diff --git a/cmd/fluxd/main.go b/cmd/fluxd/main.go index 263511969..a5c271737 100644 --- a/cmd/fluxd/main.go +++ b/cmd/fluxd/main.go @@ -36,7 +36,7 @@ import ( "github.com/weaveworks/flux/ssh" ) -var version string +var version = "unversioned" const ( // The number of connections chosen for memcache and remote GETs should match for best performance (hence the single hardcoded value) @@ -117,9 +117,6 @@ func main() { fs.Parse(os.Args) - if version == "" { - version = "unversioned" - } if *versionFlag { fmt.Println(version) os.Exit(0) @@ -132,7 +129,7 @@ func main() { logger = log.With(logger, "ts", log.DefaultTimestampUTC) logger = log.With(logger, "caller", log.DefaultCaller) } - logger.Log("started", true) + logger.Log("version", version) // Argument validation