From dbc3a3baaa8099643b2a80c06f74201539dca8ad Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Mon, 16 Oct 2017 12:09:47 -0700 Subject: [PATCH 1/2] Squelch repeated rkt version warnings --- client/driver/rkt.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/driver/rkt.go b/client/driver/rkt.go index d0238ca4c..f5744a690 100644 --- a/client/driver/rkt.go +++ b/client/driver/rkt.go @@ -328,9 +328,10 @@ func (d *RktDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, e minVersion, _ := version.NewVersion(minRktVersion) currentVersion, _ := version.NewVersion(node.Attributes["driver.rkt.version"]) - if currentVersion.LessThan(minVersion) { + if currentVersion.LessThan(minVersion) && d.fingerprintSuccess == nil { // Do not allow ancient rkt versions - d.logger.Printf("[WARN] driver.rkt: please upgrade rkt to a version >= %s", minVersion) + d.logger.Printf("[WARN] driver.rkt: unsupported rkt version %s; please upgrade to >= %s", + currentVersion, minVersion) node.Attributes[rktDriverAttr] = "0" } From 87b86230c4d62dcc310e9c620e4731f0c95ae595 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Mon, 16 Oct 2017 13:58:58 -0700 Subject: [PATCH 2/2] Properly fail rkt fingerprinting on old vesions --- client/driver/rkt.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/client/driver/rkt.go b/client/driver/rkt.go index f5744a690..7e9d99685 100644 --- a/client/driver/rkt.go +++ b/client/driver/rkt.go @@ -322,19 +322,24 @@ func (d *RktDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, e return false, fmt.Errorf("Unable to parse Rkt version string: %#v", rktMatches) } + minVersion, _ := version.NewVersion(minRktVersion) + currentVersion, _ := version.NewVersion(rktMatches[1]) + if currentVersion.LessThan(minVersion) { + // Do not allow ancient rkt versions + if d.fingerprintSuccess == nil { + // Only log on first failure + d.logger.Printf("[WARN] driver.rkt: unsupported rkt version %s; please upgrade to >= %s", + currentVersion, minVersion) + } + delete(node.Attributes, rktDriverAttr) + d.fingerprintSuccess = helper.BoolToPtr(false) + return false, nil + } + node.Attributes[rktDriverAttr] = "1" node.Attributes["driver.rkt.version"] = rktMatches[1] node.Attributes["driver.rkt.appc.version"] = appcMatches[1] - minVersion, _ := version.NewVersion(minRktVersion) - currentVersion, _ := version.NewVersion(node.Attributes["driver.rkt.version"]) - if currentVersion.LessThan(minVersion) && d.fingerprintSuccess == nil { - // Do not allow ancient rkt versions - d.logger.Printf("[WARN] driver.rkt: unsupported rkt version %s; please upgrade to >= %s", - currentVersion, minVersion) - node.Attributes[rktDriverAttr] = "0" - } - // Advertise if this node supports rkt volumes if d.config.ReadBoolDefault(rktVolumesConfigOption, rktVolumesConfigDefault) { node.Attributes["driver."+rktVolumesConfigOption] = "1"