From 85f55f02d41bf516932af6b221b35440275460ff Mon Sep 17 00:00:00 2001 From: Marcin Olszewski Date: Fri, 5 May 2017 11:26:09 +0200 Subject: [PATCH] Address further comments in review --- cmd/snaptel/flags.go | 2 +- control/control.go | 2 +- control/control_security_test.go | 2 +- control/fixtures/fixtures.go | 17 ----------------- control/fixtures/tls_cert_util.go | 5 ++--- 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/cmd/snaptel/flags.go b/cmd/snaptel/flags.go index acdad50e6..9cfc740e6 100644 --- a/cmd/snaptel/flags.go +++ b/cmd/snaptel/flags.go @@ -81,7 +81,7 @@ var ( } flPluginCACerts = cli.StringFlag{ Name: "plugin-ca-certs, r", - Usage: "List of CA cert paths for plugin (directory/file) to verify TLS clients", + Usage: "List of CA cert paths (directory/file) for plugin to verify TLS clients", } flPluginType = cli.StringFlag{ Name: "plugin-type, t", diff --git a/control/control.go b/control/control.go index de26cfa78..561e2ecba 100644 --- a/control/control.go +++ b/control/control.go @@ -222,7 +222,6 @@ func New(cfg *Config) *pluginControl { OptSetTempDirPath(cfg.TempDirPath), } runnerOpts := []pluginRunnerOpt{} - // Plugin Manager if cfg.IsTLSEnabled() { if cfg.CACertPaths != "" { certPaths := filepath.SplitList(cfg.CACertPaths) @@ -233,6 +232,7 @@ func New(cfg *Config) *pluginControl { managerOpts = append(managerOpts, OptEnableManagerTLS(c.grpcSecurity)) runnerOpts = append(runnerOpts, OptEnableRunnerTLS(c.grpcSecurity)) } + // Plugin Manager c.pluginManager = newPluginManager(managerOpts...) controlLogger.WithFields(log.Fields{ "_block": "new", diff --git a/control/control_security_test.go b/control/control_security_test.go index 93cf6dc7c..38943f079 100644 --- a/control/control_security_test.go +++ b/control/control_security_test.go @@ -1,4 +1,4 @@ -// +build medium +// + build medium /* http://www.apache.org/licenses/LICENSE-2.0.txt diff --git a/control/fixtures/fixtures.go b/control/fixtures/fixtures.go index dde12717e..9fe5a3ec0 100644 --- a/control/fixtures/fixtures.go +++ b/control/fixtures/fixtures.go @@ -155,20 +155,3 @@ func (m MockRequestedMetric) Version() int { func (m MockRequestedMetric) Namespace() core.Namespace { return m.namespace } - -// func NewExecutablePlugin(a plugin.Arg, path string) (*plugin.ExecutablePlugin, error) { -// // Travis optimization: Try starting the plugin three times before finally -// // returning an error -// var e error -// var ep *plugin.ExecutablePlugin -// for i := 0; i < 3; i++ { -// ep, e = plugin.NewExecutablePlugin(a, path) -// if e == nil { -// break -// } -// if e != nil && i == 2 { -// return nil, e -// } -// } -// return ep, nil -// } diff --git a/control/fixtures/tls_cert_util.go b/control/fixtures/tls_cert_util.go index e4a8bb8ef..892fc4230 100644 --- a/control/fixtures/tls_cert_util.go +++ b/control/fixtures/tls_cert_util.go @@ -1,4 +1,4 @@ -// +build legacy small medium large +// + build legacy small medium large /* http://www.apache.org/licenses/LICENSE-2.0.txt @@ -35,7 +35,6 @@ import ( "net" "os" "path/filepath" - "strings" "time" ) @@ -139,7 +138,7 @@ func (u CertTestUtil) MakeSubjCertKeyPair(cn, ou string, keyValidPeriod time.Dur ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, SubjectKeyId: subjPubSha256[:], } - subjCertTpl.DNSNames = strings.Fields("localhost") + subjCertTpl.DNSNames = []string{"localhost"} subjCertTpl.IPAddresses = []net.IP{net.ParseIP("127.0.0.1")} subjCertBytes, err = x509.CreateCertificate(rand.Reader, &subjCertTpl, caCertTpl, subjPrivKey.Public(), caPrivKey) return subjCertBytes, subjPrivKey, err