From 11dba9f86aabdadfbb6fa37bca364927c2e465a0 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 22 Mar 2019 13:30:14 -0400 Subject: [PATCH] udpate go-plugin --- go.mod | 2 +- go.sum | 2 ++ .../github.com/hashicorp/go-plugin/client.go | 22 ++++++++++++++++++- vendor/modules.txt | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1443a2fe1b..03b9d59355 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa // indirect github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect github.com/hashicorp/go-multierror v1.0.0 - github.com/hashicorp/go-plugin v0.0.0-20190220160451-3f118e8ee104 + github.com/hashicorp/go-plugin v0.0.0-20190322172744-52e1c4730856 github.com/hashicorp/go-retryablehttp v0.5.1 github.com/hashicorp/go-rootcerts v1.0.0 github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect diff --git a/go.sum b/go.sum index bed7ff7cb6..f1c30af10d 100644 --- a/go.sum +++ b/go.sum @@ -179,6 +179,8 @@ github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uP github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-plugin v0.0.0-20190220160451-3f118e8ee104 h1:9iQ/zrTOJqzP+kH37s6xNb6T1RysiT7fnDD3DJbspVw= github.com/hashicorp/go-plugin v0.0.0-20190220160451-3f118e8ee104/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= +github.com/hashicorp/go-plugin v0.0.0-20190322172744-52e1c4730856 h1:FHiCaU46W1WoqApsaGGIKbNkhQ6v71hJrOf2INQMLUo= +github.com/hashicorp/go-plugin v0.0.0-20190322172744-52e1c4730856/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-retryablehttp v0.5.1 h1:Vsx5XKPqPs3M6sM4U4GWyUqFS8aBiL9U5gkgvpkg4SE= github.com/hashicorp/go-retryablehttp v0.5.1/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI= diff --git a/vendor/github.com/hashicorp/go-plugin/client.go b/vendor/github.com/hashicorp/go-plugin/client.go index 2a8b42fc3b..8118b5876c 100644 --- a/vendor/github.com/hashicorp/go-plugin/client.go +++ b/vendor/github.com/hashicorp/go-plugin/client.go @@ -973,7 +973,22 @@ func (c *Client) logStderr(r io.Reader) { entry, err := parseJSON(line) // If output is not JSON format, print directly to Debug if err != nil { - l.Debug(string(line)) + // Attempt to infer the desired log level from the commonly used + // string prefixes + switch line := string(line); { + case strings.HasPrefix("[TRACE]", line): + l.Trace(line) + case strings.HasPrefix("[DEBUG]", line): + l.Debug(line) + case strings.HasPrefix("[INFO]", line): + l.Info(line) + case strings.HasPrefix("[WARN]", line): + l.Warn(line) + case strings.HasPrefix("[ERROR]", line): + l.Error(line) + default: + l.Debug(line) + } } else { out := flattenKVPairs(entry.KVPairs) @@ -989,6 +1004,11 @@ func (c *Client) logStderr(r io.Reader) { l.Warn(entry.Message, out...) case hclog.Error: l.Error(entry.Message, out...) + default: + // if there was no log level, it's likely this is unexpected + // json from something other than hclog, and we should output + // it verbatim. + l.Debug(string(line)) } } } diff --git a/vendor/modules.txt b/vendor/modules.txt index a5e1f18d02..fea13860da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -279,7 +279,7 @@ github.com/hashicorp/go-getter/helper/url github.com/hashicorp/go-hclog # github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-multierror -# github.com/hashicorp/go-plugin v0.0.0-20190220160451-3f118e8ee104 +# github.com/hashicorp/go-plugin v0.0.0-20190322172744-52e1c4730856 github.com/hashicorp/go-plugin github.com/hashicorp/go-plugin/internal/plugin # github.com/hashicorp/go-retryablehttp v0.5.1