From 5db69c2f85c3dca78f70e7e455eebadbd803f91e Mon Sep 17 00:00:00 2001 From: Hridoy Roy Date: Mon, 22 Feb 2021 14:24:27 -0800 Subject: [PATCH] upgrade consul template (#10973) --- go.mod | 2 +- go.sum | 2 ++ .../consul-template/dependency/vault_common.go | 13 +++++++++++-- .../hashicorp/consul-template/logging/logging.go | 5 ++--- .../hashicorp/consul-template/version/version.go | 2 +- vendor/modules.txt | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index beede086d2..0a35e7f374 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/golang/protobuf v1.4.2 github.com/google/go-github v17.0.0+incompatible github.com/google/go-metrics-stackdriver v0.2.0 - github.com/hashicorp/consul-template v0.25.2-0.20210123001810-166043f8559d + github.com/hashicorp/consul-template v0.25.2 github.com/hashicorp/consul/api v1.4.0 github.com/hashicorp/errwrap v1.1.0 github.com/hashicorp/go-bindata v3.0.8-0.20180209072458-bf7910af8997+incompatible diff --git a/go.sum b/go.sum index 2599f19c23..7994f097f3 100644 --- a/go.sum +++ b/go.sum @@ -537,6 +537,8 @@ github.com/hashicorp/cap v0.0.0-20210204173447-5fcddadbf7c7 h1:6OHvaQs9ys66bR1yq github.com/hashicorp/cap v0.0.0-20210204173447-5fcddadbf7c7/go.mod h1:tIk5rB1nihW5+9bZjI7xlc8LGw8FYfiFMKOpHPbWgug= github.com/hashicorp/consul-template v0.25.2-0.20210123001810-166043f8559d h1:DSrhJ8Nqyr3oleIu0rCjRV4j6f4CJSPUp5DljXKKu4w= github.com/hashicorp/consul-template v0.25.2-0.20210123001810-166043f8559d/go.mod h1:kNLSN13aPJz/P0we1XNU+ZDsjkbzX+iHJ+dJOqFZck0= +github.com/hashicorp/consul-template v0.25.2 h1:4xTeLZR/pWX2mESkXSvriOy+eI5vp9z3p7DF5wBlch0= +github.com/hashicorp/consul-template v0.25.2/go.mod h1:5kVbPpbJvxZl3r9aV1Plqur9bszus668jkx6z2umb6o= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.4.0 h1:jfESivXnO5uLdH650JU/6AnjRoHrLhULq0FnC3Kp9EY= github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= diff --git a/vendor/github.com/hashicorp/consul-template/dependency/vault_common.go b/vendor/github.com/hashicorp/consul-template/dependency/vault_common.go index c3496b0ce9..2ef59a4a5b 100644 --- a/vendor/github.com/hashicorp/consul-template/dependency/vault_common.go +++ b/vendor/github.com/hashicorp/consul-template/dependency/vault_common.go @@ -1,13 +1,12 @@ package dependency import ( + "encoding/json" "fmt" "log" "math/rand" "time" - "encoding/json" - "github.com/hashicorp/vault/api" ) @@ -122,6 +121,16 @@ func leaseCheckWait(s *Secret) time.Duration { } } + // Handle if this is an AppRole secret_id with no lease + if _, ok := s.Data["secret_id"]; ok && s.LeaseID == "" { + if expInterface, ok := s.Data["secret_id_ttl"]; ok { + if ttlData, err := expInterface.(json.Number).Int64(); err == nil && ttlData > 0 { + base = int(ttlData) + 1 + log.Printf("[DEBUG] Found approle secret_id and non-zero secret_id_ttl, setting lease duration to %d seconds", base) + } + } + } + // Handle if this is a secret with a rotation period. If this is a rotating secret, // the rotating secret's TTL will be the duration to sleep before rendering the new secret. var rotatingSecret bool diff --git a/vendor/github.com/hashicorp/consul-template/logging/logging.go b/vendor/github.com/hashicorp/consul-template/logging/logging.go index 5ef2a119ac..08e2e12e84 100644 --- a/vendor/github.com/hashicorp/consul-template/logging/logging.go +++ b/vendor/github.com/hashicorp/consul-template/logging/logging.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/hashicorp/go-syslog" + gsyslog "github.com/hashicorp/go-syslog" "github.com/hashicorp/logutils" ) @@ -32,7 +32,7 @@ type Config struct { Syslog bool `json:"syslog"` SyslogFacility string `json:"syslog_facility"` // SyslogName is the progname as it will appear in syslog output (if enabled). - SyslogName string `json:"name"` + SyslogName string `json:"name"` // Writer is the output where logs should go. If syslog is enabled, data will // be written to writer in addition to syslog. @@ -73,7 +73,6 @@ func Setup(config *Config) error { } log.SetOutput(logOutput) - log.SetOutput(new(logWriter)) return nil } diff --git a/vendor/github.com/hashicorp/consul-template/version/version.go b/vendor/github.com/hashicorp/consul-template/version/version.go index 482e3e8453..e3a1776ee1 100644 --- a/vendor/github.com/hashicorp/consul-template/version/version.go +++ b/vendor/github.com/hashicorp/consul-template/version/version.go @@ -2,7 +2,7 @@ package version import "fmt" -const Version = "0.25.1" +const Version = "0.25.2" var ( Name string diff --git a/vendor/modules.txt b/vendor/modules.txt index fd8ff63e39..1ea0756405 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -427,7 +427,7 @@ github.com/hashicorp/cap/jwt github.com/hashicorp/cap/oidc github.com/hashicorp/cap/oidc/internal/base62 github.com/hashicorp/cap/oidc/internal/strutils -# github.com/hashicorp/consul-template v0.25.2-0.20210123001810-166043f8559d +# github.com/hashicorp/consul-template v0.25.2 github.com/hashicorp/consul-template/child github.com/hashicorp/consul-template/config github.com/hashicorp/consul-template/dependency