From fdd8d352f934d8b59350b40c3f9e5f4dbd1c20e8 Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Thu, 10 Dec 2020 21:26:10 -0600 Subject: [PATCH] command: remove use of flag impls from consul In a few places Nomad was using flag implementations directly from Consul, lending to Nomad's need to import consul. Replace those uses with helpers already in Nomad, and copy over the bare minimum needed to make the autopilot flags behave as they have. --- api/go.sum | 4 - command/job_plan.go | 24 +- command/job_run.go | 36 +- command/job_validate.go | 18 +- command/operator_autopilot_set.go | 49 +-- go.sum | 32 -- helper/flag-helpers/autopilot_flags.go | 103 ++++++ helper/flag-helpers/autopilot_flags_test.go | 79 +++++ helper/flag-helpers/flag_test.go | 25 ++ tools/go.sum | 3 - .../hashicorp/consul/command/flags/config.go | 310 ------------------ .../consul/command/flags/flag_map_value.go | 37 --- .../consul/command/flags/flag_slice_value.go | 20 -- .../hashicorp/consul/command/flags/http.go | 150 --------- .../hashicorp/consul/command/flags/merge.go | 15 - .../hashicorp/consul/command/flags/usage.go | 114 ------- vendor/github.com/hashicorp/nomad/api/go.sum | 4 - vendor/modules.txt | 1 - 18 files changed, 275 insertions(+), 749 deletions(-) create mode 100644 helper/flag-helpers/autopilot_flags.go create mode 100644 helper/flag-helpers/autopilot_flags_test.go delete mode 100644 vendor/github.com/hashicorp/consul/command/flags/config.go delete mode 100644 vendor/github.com/hashicorp/consul/command/flags/flag_map_value.go delete mode 100644 vendor/github.com/hashicorp/consul/command/flags/flag_slice_value.go delete mode 100644 vendor/github.com/hashicorp/consul/command/flags/http.go delete mode 100644 vendor/github.com/hashicorp/consul/command/flags/merge.go delete mode 100644 vendor/github.com/hashicorp/consul/command/flags/usage.go diff --git a/api/go.sum b/api/go.sum index d36fa2f71..e723eabc6 100644 --- a/api/go.sum +++ b/api/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -25,15 +24,12 @@ github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8 github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/command/job_plan.go b/command/job_plan.go index ebf8a2f9c..b84ff93db 100644 --- a/command/job_plan.go +++ b/command/job_plan.go @@ -6,8 +6,8 @@ import ( "strings" "time" - cflags "github.com/hashicorp/consul/command/flags" "github.com/hashicorp/nomad/api" + flaghelper "github.com/hashicorp/nomad/helper/flag-helpers" "github.com/hashicorp/nomad/scheduler" "github.com/posener/complete" ) @@ -117,23 +117,23 @@ func (c *JobPlanCommand) AutocompleteArgs() complete.Predictor { func (c *JobPlanCommand) Name() string { return "job plan" } func (c *JobPlanCommand) Run(args []string) int { var diff, policyOverride, verbose bool - var varArgs, varFiles cflags.AppendSliceValue + var varArgs, varFiles flaghelper.StringFlag - flags := c.Meta.FlagSet(c.Name(), FlagSetClient) - flags.Usage = func() { c.Ui.Output(c.Help()) } - flags.BoolVar(&diff, "diff", true, "") - flags.BoolVar(&policyOverride, "policy-override", false, "") - flags.BoolVar(&verbose, "verbose", false, "") - flags.BoolVar(&c.JobGetter.hcl1, "hcl1", false, "") - flags.Var(&varArgs, "var", "") - flags.Var(&varFiles, "var-file", "") + flagSet := c.Meta.FlagSet(c.Name(), FlagSetClient) + flagSet.Usage = func() { c.Ui.Output(c.Help()) } + flagSet.BoolVar(&diff, "diff", true, "") + flagSet.BoolVar(&policyOverride, "policy-override", false, "") + flagSet.BoolVar(&verbose, "verbose", false, "") + flagSet.BoolVar(&c.JobGetter.hcl1, "hcl1", false, "") + flagSet.Var(&varArgs, "var", "") + flagSet.Var(&varFiles, "var-file", "") - if err := flags.Parse(args); err != nil { + if err := flagSet.Parse(args); err != nil { return 255 } // Check that we got exactly one job - args = flags.Args() + args = flagSet.Args() if len(args) != 1 { c.Ui.Error("This command takes one argument: ") c.Ui.Error(commandErrorText(c)) diff --git a/command/job_run.go b/command/job_run.go index 19b6c782d..ce73c4834 100644 --- a/command/job_run.go +++ b/command/job_run.go @@ -9,9 +9,9 @@ import ( "strings" "time" - cflags "github.com/hashicorp/consul/command/flags" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/helper" + flaghelper "github.com/hashicorp/nomad/helper/flag-helpers" "github.com/posener/complete" ) @@ -158,24 +158,24 @@ func (c *JobRunCommand) Name() string { return "job run" } func (c *JobRunCommand) Run(args []string) int { var detach, verbose, output, override, preserveCounts bool var checkIndexStr, consulToken, vaultToken, vaultNamespace string - var varArgs, varFiles cflags.AppendSliceValue + var varArgs, varFiles flaghelper.StringFlag - flags := c.Meta.FlagSet(c.Name(), FlagSetClient) - flags.Usage = func() { c.Ui.Output(c.Help()) } - flags.BoolVar(&detach, "detach", false, "") - flags.BoolVar(&verbose, "verbose", false, "") - flags.BoolVar(&output, "output", false, "") - flags.BoolVar(&override, "policy-override", false, "") - flags.BoolVar(&preserveCounts, "preserve-counts", false, "") - flags.BoolVar(&c.JobGetter.hcl1, "hcl1", false, "") - flags.StringVar(&checkIndexStr, "check-index", "", "") - flags.StringVar(&consulToken, "consul-token", "", "") - flags.StringVar(&vaultToken, "vault-token", "", "") - flags.StringVar(&vaultNamespace, "vault-namespace", "", "") - flags.Var(&varArgs, "var", "") - flags.Var(&varFiles, "var-file", "") + flagSet := c.Meta.FlagSet(c.Name(), FlagSetClient) + flagSet.Usage = func() { c.Ui.Output(c.Help()) } + flagSet.BoolVar(&detach, "detach", false, "") + flagSet.BoolVar(&verbose, "verbose", false, "") + flagSet.BoolVar(&output, "output", false, "") + flagSet.BoolVar(&override, "policy-override", false, "") + flagSet.BoolVar(&preserveCounts, "preserve-counts", false, "") + flagSet.BoolVar(&c.JobGetter.hcl1, "hcl1", false, "") + flagSet.StringVar(&checkIndexStr, "check-index", "", "") + flagSet.StringVar(&consulToken, "consul-token", "", "") + flagSet.StringVar(&vaultToken, "vault-token", "", "") + flagSet.StringVar(&vaultNamespace, "vault-namespace", "", "") + flagSet.Var(&varArgs, "var", "") + flagSet.Var(&varFiles, "var-file", "") - if err := flags.Parse(args); err != nil { + if err := flagSet.Parse(args); err != nil { return 1 } @@ -186,7 +186,7 @@ func (c *JobRunCommand) Run(args []string) int { } // Check that we got exactly one argument - args = flags.Args() + args = flagSet.Args() if len(args) != 1 { c.Ui.Error("This command takes one argument: ") c.Ui.Error(commandErrorText(c)) diff --git a/command/job_validate.go b/command/job_validate.go index 5a16ff66a..69d2a4ee1 100644 --- a/command/job_validate.go +++ b/command/job_validate.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - cflags "github.com/hashicorp/consul/command/flags" multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/command/agent" + flaghelper "github.com/hashicorp/nomad/helper/flag-helpers" "github.com/hashicorp/nomad/nomad/structs" "github.com/posener/complete" ) @@ -66,20 +66,20 @@ func (c *JobValidateCommand) AutocompleteArgs() complete.Predictor { func (c *JobValidateCommand) Name() string { return "job validate" } func (c *JobValidateCommand) Run(args []string) int { - var varArgs, varFiles cflags.AppendSliceValue + var varArgs, varFiles flaghelper.StringFlag - flags := c.Meta.FlagSet(c.Name(), FlagSetNone) - flags.Usage = func() { c.Ui.Output(c.Help()) } - flags.BoolVar(&c.JobGetter.hcl1, "hcl1", false, "") - flags.Var(&varArgs, "var", "") - flags.Var(&varFiles, "var-file", "") + flagSet := c.Meta.FlagSet(c.Name(), FlagSetNone) + flagSet.Usage = func() { c.Ui.Output(c.Help()) } + flagSet.BoolVar(&c.JobGetter.hcl1, "hcl1", false, "") + flagSet.Var(&varArgs, "var", "") + flagSet.Var(&varFiles, "var-file", "") - if err := flags.Parse(args); err != nil { + if err := flagSet.Parse(args); err != nil { return 1 } // Check that we got exactly one node - args = flags.Args() + args = flagSet.Args() if len(args) != 1 { c.Ui.Error("This command takes one argument: ") c.Ui.Error(commandErrorText(c)) diff --git a/command/operator_autopilot_set.go b/command/operator_autopilot_set.go index c055d8666..138dcff60 100644 --- a/command/operator_autopilot_set.go +++ b/command/operator_autopilot_set.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/hashicorp/consul/command/flags" + flaghelper "github.com/hashicorp/nomad/helper/flag-helpers" "github.com/posener/complete" ) @@ -32,28 +32,34 @@ func (c *OperatorAutopilotSetCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorAutopilotSetCommand) Name() string { return "operator autopilot set-config" } func (c *OperatorAutopilotSetCommand) Run(args []string) int { - var cleanupDeadServers flags.BoolValue - var maxTrailingLogs flags.UintValue - var minQuorum flags.UintValue - var lastContactThreshold flags.DurationValue - var serverStabilizationTime flags.DurationValue - var enableRedundancyZones flags.BoolValue - var disableUpgradeMigration flags.BoolValue - var enableCustomUpgrades flags.BoolValue + // Autopilot command line flags behave differently from other commands + // in Nomad. Here, flags assume no default value. The value of the flag + // is taken into consideration if the flag is set, whether or not it contains + // the zero value when being applied to inherited configuration. + // + // This behavior was inherited from Consul. + var cleanupDeadServers flaghelper.BoolValue + var maxTrailingLogs flaghelper.UintValue + var minQuorum flaghelper.UintValue + var lastContactThreshold flaghelper.DurationValue + var serverStabilizationTime flaghelper.DurationValue + var enableRedundancyZones flaghelper.BoolValue + var disableUpgradeMigration flaghelper.BoolValue + var enableCustomUpgrades flaghelper.BoolValue - f := c.Meta.FlagSet("autopilot", FlagSetClient) - f.Usage = func() { c.Ui.Output(c.Help()) } + flagSet := c.Meta.FlagSet("autopilot", FlagSetClient) + flagSet.Usage = func() { c.Ui.Output(c.Help()) } - f.Var(&cleanupDeadServers, "cleanup-dead-servers", "") - f.Var(&maxTrailingLogs, "max-trailing-logs", "") - f.Var(&lastContactThreshold, "last-contact-threshold", "") - f.Var(&serverStabilizationTime, "server-stabilization-time", "") - f.Var(&enableRedundancyZones, "enable-redundancy-zones", "") - f.Var(&disableUpgradeMigration, "disable-upgrade-migration", "") - f.Var(&enableCustomUpgrades, "enable-custom-upgrades", "") - f.Var(&minQuorum, "min-quorum", "") + flagSet.Var(&cleanupDeadServers, "cleanup-dead-servers", "") + flagSet.Var(&maxTrailingLogs, "max-trailing-logs", "") + flagSet.Var(&lastContactThreshold, "last-contact-threshold", "") + flagSet.Var(&serverStabilizationTime, "server-stabilization-time", "") + flagSet.Var(&enableRedundancyZones, "enable-redundancy-zones", "") + flagSet.Var(&disableUpgradeMigration, "disable-upgrade-migration", "") + flagSet.Var(&enableCustomUpgrades, "enable-custom-upgrades", "") + flagSet.Var(&minQuorum, "min-quorum", "") - if err := f.Parse(args); err != nil { + if err := flagSet.Parse(args); err != nil { c.Ui.Error(fmt.Sprintf("Failed to parse args: %v", err)) return 1 } @@ -82,8 +88,11 @@ func (c *OperatorAutopilotSetCommand) Run(args []string) int { trailing := uint(conf.MaxTrailingLogs) maxTrailingLogs.Merge(&trailing) conf.MaxTrailingLogs = uint64(trailing) + minQuorum.Merge(&conf.MinQuorum) + lastContactThreshold.Merge(&conf.LastContactThreshold) + serverStabilizationTime.Merge(&conf.ServerStabilizationTime) // Check-and-set the new configuration. diff --git a/go.sum b/go.sum index 955f1254d..ab4fee8c7 100644 --- a/go.sum +++ b/go.sum @@ -22,7 +22,6 @@ github.com/Azure/azure-sdk-for-go v44.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9mo github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v10.15.3+incompatible h1:nhKI/bvazIs3C3TFGoSqKY6hZ8f5od5mb5/UcS6HVIY= github.com/Azure/go-autorest v10.15.3+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= @@ -104,7 +103,6 @@ github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/aws/aws-sdk-go v1.25.41 h1:/hj7nZ0586wFqpwjNpzWiUTwtaMgxAZNZKHay80MdXw= github.com/aws/aws-sdk-go v1.25.41/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.35.3 h1:r0puXncSaAfRt7Btml2swUo74Kao+vKhO3VLjwDjK54= github.com/aws/aws-sdk-go v1.35.3/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= @@ -128,7 +126,6 @@ github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= -github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -142,7 +139,6 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533 h1:8wZizuKuZVu5COB7EsBYxBQz8nRcXXn5d4Gt91eJLvU= github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f h1:m2LYF3fo9IPapVt5FGRVw5bJPmlWqWIezB0jkQh03Zo= github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= @@ -167,7 +163,6 @@ github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f h1:zLuuw github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2 h1:WT1OeJOkmYxVP5/e3P+/MVJ1ftii14o80u0N9aK2tCg= github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2/go.mod h1:dagHaAhNjXjT9QYOklkKJDGaQPTg4pf//FrUcJeb7FU= -github.com/coredns/coredns v1.1.2 h1:bAFHrSsBeTeRG5W3Nf2su3lUGw7Npw2UKeCJm/3A638= github.com/coredns/coredns v1.1.2/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0= github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d h1:9n0vuQxZw5yuleXDNqGLSw3o5s6vZJJH36ZSU7626zw= github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= @@ -235,9 +230,7 @@ github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948 h1:PgcXIRC4 github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.5 h1:lRJIqDD8yjV1YyPRqecMdytjDLs2fTXq363aCib5xPU= github.com/envoyproxy/go-control-plane v0.9.5/go.mod h1:OXl5to++W0ctG+EHWTFUjiypVxC/Y4VLc/KFU+al13s= -github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -304,7 +297,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 h1:zLTLjkaOFEFIOxY5BWLFLwh+cL8vOBW4XJ2aqLE/Tf0= github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -318,7 +310,6 @@ github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g= github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -330,7 +321,6 @@ github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39 h1:MqvH60+R2JhSdvVgGxmExOndrkRQtGW7w4+gcrymN64= github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= @@ -344,21 +334,18 @@ github.com/hashicorp/consul/api v1.6.0/go.mod h1:1NSuaUUkFaJzMasbfq/11wKYWSR67Xn github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= github.com/hashicorp/consul/sdk v0.6.0 h1:FfhMEkwvQl57CildXJyGHnwGGM4HMODGyfjGwNM1Vdw= github.com/hashicorp/consul/sdk v0.6.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= -github.com/hashicorp/cronexpr v1.1.0 h1:dnNsWtH0V2ReN7JccYe8m//Bj14+PjJDntR1dz0Cixk= github.com/hashicorp/cronexpr v1.1.0/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= github.com/hashicorp/cronexpr v1.1.1 h1:NJZDd87hGXjoZBdvyCF9mX4DCq5Wy7+A/w+A7q0wn6c= github.com/hashicorp/cronexpr v1.1.1/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-bexpr v0.1.2 h1:ijMXI4qERbzxbCnkxmfUtwMyjrrk3y+Vt0MxojNCbBs= github.com/hashicorp/go-bexpr v0.1.2/go.mod h1:ANbpTX1oAql27TZkKVeW8p1w8NTdnyzPe/0qqPCKohU= github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8= github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-connlimit v0.2.0 h1:OZjcfNxH/hPh/bT2Iw5yOJcLzz+zuIWpsp3I1S4Pjw4= github.com/hashicorp/go-connlimit v0.2.0/go.mod h1:OUj9FGL1tPIhl/2RCfzYHrIiWj+VVPGNyVPnUX8AqS0= github.com/hashicorp/go-connlimit v0.3.0 h1:oAojHGjFxUTTTA8c5XXnDqWJ2HLuWbDiBPTpWvNzvqM= github.com/hashicorp/go-connlimit v0.3.0/go.mod h1:OUj9FGL1tPIhl/2RCfzYHrIiWj+VVPGNyVPnUX8AqS0= @@ -379,7 +366,6 @@ github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tk github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.2.0 h1:l6UW37iCXwZkZoAbEYnptSHVE/cQ5bOTPYG5W3vf9+8= github.com/hashicorp/go-immutable-radix v1.2.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE= github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -397,7 +383,6 @@ github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+ github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55 h1:XzRWU4VSJBqGVxl6tWD+6ITHftMhvRDKKyp1WVSXAhY= github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-raftchunking v0.6.1 h1:moEnaG3gcwsWNyIBJoD5PCByE+Ewkqxh6N05CT+MbwA= github.com/hashicorp/go-raftchunking v0.6.1/go.mod h1:cGlg3JtDy7qy6c/3Bu660Mic1JF+7lWqIwCFSb08fX0= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.5.4 h1:1BZvpawXoJCWX6pNtow9+rpEj+3itIlutiqnntI6jOE= @@ -428,7 +413,6 @@ github.com/hashicorp/hcl v1.0.1-0.20201016140508-a07e7d50bbee h1:8B4HqvMUtYSjsGk github.com/hashicorp/hcl v1.0.1-0.20201016140508-a07e7d50bbee/go.mod h1:gwlu9+/P9MmKtYrMsHeFRZPXj2CTPm11TDnMeaRHS7g= github.com/hashicorp/hcl/v2 v2.7.1-0.20201020204811-68a97f93bb48 h1:iaau0VStfX9CgOlpbceawI94uVEM3sliqnjpHSVQqUo= github.com/hashicorp/hcl/v2 v2.7.1-0.20201020204811-68a97f93bb48/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= -github.com/hashicorp/hil v0.0.0-20160711231837-1e86c6b523c5 h1:uk280DXEbQiCOZgCOI3elFSeNxf8YIZiNsbr2pQLYD0= github.com/hashicorp/hil v0.0.0-20160711231837-1e86c6b523c5/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= @@ -467,7 +451,6 @@ github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745 h1:8as8OQ+RF1QrsHvW github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07 h1:rw3IAne6CDuVFlZbPOkA7bhxlqawFh7RJJ+CejfMaxE= @@ -476,7 +459,6 @@ github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da h1:FjHUJJ7oBW4G/9 github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -487,7 +469,6 @@ github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 h1:BvV6PYcRz0yGnW github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -570,10 +551,8 @@ github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx github.com/moby/sys/mountinfo v0.1.3 h1:KIrhRO14+AkwKvG/g2yIpNMOUVZ02xNhOw8KY1WsLOI= github.com/moby/sys/mountinfo v0.1.3/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= @@ -592,7 +571,6 @@ github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 h1:R9vmquWCeGmxTHUVnTQ github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -623,7 +601,6 @@ github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c/go.mod h1:otz github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.2.5+incompatible h1:xOYu2+sKj87pJz7V+I7260354UlcRyAZUGhMCToTzVw= @@ -662,7 +639,6 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/rboyer/safeio v0.2.1 h1:05xhhdRNAdS3apYm7JRjOqngf4xruaW959jmRxGDuSU= github.com/rboyer/safeio v0.2.1/go.mod h1:Cq/cEPK+YXFn622lsQ0K4KsPZSPtaptHHEldsy7Fmig= github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03 h1:Wdi9nwnhFNAlseAOekn6B5G/+GMtks9UKbvRU/CMM/o= github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03/go.mod h1:gRAiPF5C5Nd0eyyRdqIu9qTiFSoZzpTq727b5B8fkkU= @@ -709,7 +685,6 @@ github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzu github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -974,7 +949,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -1006,27 +980,21 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.0.0-20190325185214-7544f9db76f6/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= -k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/apimachinery v0.0.0-20190223001710-c182ff3b9841/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= -k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= -k8s.io/client-go v8.0.0+incompatible h1:tTI4hRmb1DRMl4fG6Vclfdi6nTM82oIrTT7HfitmxC4= k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= -sigs.k8s.io/structured-merge-diff/v3 v3.0.0 h1:dOmIZBMfhcHS09XZkMyUgkq5trg3/jRyJYFZUiaOp8E= sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/helper/flag-helpers/autopilot_flags.go b/helper/flag-helpers/autopilot_flags.go new file mode 100644 index 000000000..47e01a4d3 --- /dev/null +++ b/helper/flag-helpers/autopilot_flags.go @@ -0,0 +1,103 @@ +package flaghelper + +// These flag type implementations are provided to maintain autopilot command +// backwards compatibility. + +import ( + "fmt" + "strconv" + "time" +) + +// BoolValue provides a flag value that's aware if it has been set. +type BoolValue struct { + v *bool +} + +// Merge will overlay this value if it has been set. +func (b *BoolValue) Merge(onto *bool) { + if b.v != nil { + *onto = *(b.v) + } +} + +// Set implements the flag.Value interface. +func (b *BoolValue) Set(v string) error { + if b.v == nil { + b.v = new(bool) + } + var err error + *(b.v), err = strconv.ParseBool(v) + return err +} + +// String implements the flag.Value interface. +func (b *BoolValue) String() string { + var current bool + if b.v != nil { + current = *(b.v) + } + return fmt.Sprintf("%v", current) +} + +// DurationValue provides a flag value that's aware if it has been set. +type DurationValue struct { + v *time.Duration +} + +// Merge will overlay this value if it has been set. +func (d *DurationValue) Merge(onto *time.Duration) { + if d.v != nil { + *onto = *(d.v) + } +} + +// Set implements the flag.Value interface. +func (d *DurationValue) Set(v string) error { + if d.v == nil { + d.v = new(time.Duration) + } + var err error + *(d.v), err = time.ParseDuration(v) + return err +} + +// String implements the flag.Value interface. +func (d *DurationValue) String() string { + var current time.Duration + if d.v != nil { + current = *(d.v) + } + return current.String() +} + +// UintValue provides a flag value that's aware if it has been set. +type UintValue struct { + v *uint +} + +// Merge will overlay this value if it has been set. +func (u *UintValue) Merge(onto *uint) { + if u.v != nil { + *onto = *(u.v) + } +} + +// Set implements the flag.Value interface. +func (u *UintValue) Set(v string) error { + if u.v == nil { + u.v = new(uint) + } + parsed, err := strconv.ParseUint(v, 0, 64) + *(u.v) = (uint)(parsed) + return err +} + +// String implements the flag.Value interface. +func (u *UintValue) String() string { + var current uint + if u.v != nil { + current = *(u.v) + } + return fmt.Sprintf("%v", current) +} diff --git a/helper/flag-helpers/autopilot_flags_test.go b/helper/flag-helpers/autopilot_flags_test.go new file mode 100644 index 000000000..2d29fdbf3 --- /dev/null +++ b/helper/flag-helpers/autopilot_flags_test.go @@ -0,0 +1,79 @@ +package flaghelper + +import ( + "flag" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestFlagHelper_Pointers_Set(t *testing.T) { + t.Parallel() + + var ( + B BoolValue + b bool = true + + D DurationValue + d time.Duration = 2 * time.Minute + + U UintValue + u uint = 99 + ) + flagSet := flag.NewFlagSet("test", flag.PanicOnError) + flagSet.Var(&B, "b", "bool") + flagSet.Var(&D, "d", "duration") + flagSet.Var(&U, "u", "uint") + + args := []string{"-b", "false", "-d", "1m", "-u", "42"} + err := flagSet.Parse(args) + require.NoError(t, err) + + require.Equal(t, "false", B.String()) + B.Merge(&b) + require.Equal(t, false, b) + + require.Equal(t, "1m0s", D.String()) + D.Merge(&d) + require.Equal(t, 1*time.Minute, d) + + require.Equal(t, "42", U.String()) + U.Merge(&u) + require.Equal(t, uint(42), u) +} + +func TestFlagHelper_Pointers_Ignored(t *testing.T) { + t.Parallel() + + var ( + B BoolValue + b bool = true + + D DurationValue + d time.Duration = 2 * time.Minute + + U UintValue + u uint = 99 + ) + flagSet := flag.NewFlagSet("test", flag.PanicOnError) + flagSet.Var(&B, "b", "bool") + flagSet.Var(&D, "d", "duration") + flagSet.Var(&U, "u", "uint") + + var args []string + err := flagSet.Parse(args) + require.NoError(t, err) + + require.Equal(t, "false", B.String()) + B.Merge(&b) + require.Equal(t, true, b) + + require.Equal(t, "0s", D.String()) + D.Merge(&d) + require.Equal(t, 2*time.Minute, d) + + require.Equal(t, "0", U.String()) + U.Merge(&u) + require.Equal(t, uint(99), u) +} diff --git a/helper/flag-helpers/flag_test.go b/helper/flag-helpers/flag_test.go index 7893c0e15..fbcffe8e3 100644 --- a/helper/flag-helpers/flag_test.go +++ b/helper/flag-helpers/flag_test.go @@ -4,9 +4,13 @@ import ( "flag" "reflect" "testing" + + "github.com/stretchr/testify/require" ) func TestStringFlag_implements(t *testing.T) { + t.Parallel() + var raw interface{} raw = new(StringFlag) if _, ok := raw.(flag.Value); !ok { @@ -15,6 +19,8 @@ func TestStringFlag_implements(t *testing.T) { } func TestStringFlagSet(t *testing.T) { + t.Parallel() + sv := new(StringFlag) err := sv.Set("foo") if err != nil { @@ -31,3 +37,22 @@ func TestStringFlagSet(t *testing.T) { t.Fatalf("Bad: %#v", sv) } } +func TestStringFlagSet_Append(t *testing.T) { + t.Parallel() + + var ( + // A test to make sure StringFlag can replace AppendSliceValue + // for autopilot flags inherited from Consul. + hosts StringFlag + ) + + flagSet := flag.NewFlagSet("test", flag.PanicOnError) + flagSet.Var(&hosts, "host", "host, specify more than once") + + args := []string{"-host", "foo", "-host", "bar", "-host", "baz"} + err := flagSet.Parse(args) + require.NoError(t, err) + + result := hosts.String() + require.Equal(t, "foo,bar,baz", result) +} diff --git a/tools/go.sum b/tools/go.sum index 427f55f98..51d6a9753 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -223,7 +223,6 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= @@ -236,7 +235,6 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -377,7 +375,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 h1:rOhMmluY6kLMhdnrivzec6lLgaVbMHMn2ISQXJeJ5EM= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/hashicorp/consul/command/flags/config.go b/vendor/github.com/hashicorp/consul/command/flags/config.go deleted file mode 100644 index be8f91436..000000000 --- a/vendor/github.com/hashicorp/consul/command/flags/config.go +++ /dev/null @@ -1,310 +0,0 @@ -package flags - -import ( - "fmt" - "os" - "path/filepath" - "reflect" - "sort" - "strconv" - "time" - - "github.com/mitchellh/mapstructure" -) - -// TODO (slackpad) - Trying out a different pattern here for config handling. -// These classes support the flag.Value interface but work in a manner where -// we can tell if they have been set. This lets us work with an all-pointer -// config structure and merge it in a clean-ish way. If this ends up being a -// good pattern we should pull this out into a reusable library. - -// ConfigDecodeHook should be passed to mapstructure in order to decode into -// the *Value objects here. -var ConfigDecodeHook = mapstructure.ComposeDecodeHookFunc( - BoolToBoolValueFunc(), - StringToDurationValueFunc(), - StringToStringValueFunc(), - Float64ToUintValueFunc(), -) - -// BoolValue provides a flag value that's aware if it has been set. -type BoolValue struct { - v *bool -} - -// IsBoolFlag is an optional method of the flag.Value -// interface which marks this value as boolean when -// the return value is true. See flag.Value for details. -func (b *BoolValue) IsBoolFlag() bool { - return true -} - -// Merge will overlay this value if it has been set. -func (b *BoolValue) Merge(onto *bool) { - if b.v != nil { - *onto = *(b.v) - } -} - -// Set implements the flag.Value interface. -func (b *BoolValue) Set(v string) error { - if b.v == nil { - b.v = new(bool) - } - var err error - *(b.v), err = strconv.ParseBool(v) - return err -} - -// String implements the flag.Value interface. -func (b *BoolValue) String() string { - var current bool - if b.v != nil { - current = *(b.v) - } - return fmt.Sprintf("%v", current) -} - -// BoolToBoolValueFunc is a mapstructure hook that looks for an incoming bool -// mapped to a BoolValue and does the translation. -func BoolToBoolValueFunc() mapstructure.DecodeHookFunc { - return func( - f reflect.Type, - t reflect.Type, - data interface{}) (interface{}, error) { - if f.Kind() != reflect.Bool { - return data, nil - } - - val := BoolValue{} - if t != reflect.TypeOf(val) { - return data, nil - } - - val.v = new(bool) - *(val.v) = data.(bool) - return val, nil - } -} - -// DurationValue provides a flag value that's aware if it has been set. -type DurationValue struct { - v *time.Duration -} - -// Merge will overlay this value if it has been set. -func (d *DurationValue) Merge(onto *time.Duration) { - if d.v != nil { - *onto = *(d.v) - } -} - -// Set implements the flag.Value interface. -func (d *DurationValue) Set(v string) error { - if d.v == nil { - d.v = new(time.Duration) - } - var err error - *(d.v), err = time.ParseDuration(v) - return err -} - -// String implements the flag.Value interface. -func (d *DurationValue) String() string { - var current time.Duration - if d.v != nil { - current = *(d.v) - } - return current.String() -} - -// StringToDurationValueFunc is a mapstructure hook that looks for an incoming -// string mapped to a DurationValue and does the translation. -func StringToDurationValueFunc() mapstructure.DecodeHookFunc { - return func( - f reflect.Type, - t reflect.Type, - data interface{}) (interface{}, error) { - if f.Kind() != reflect.String { - return data, nil - } - - val := DurationValue{} - if t != reflect.TypeOf(val) { - return data, nil - } - if err := val.Set(data.(string)); err != nil { - return nil, err - } - return val, nil - } -} - -// StringValue provides a flag value that's aware if it has been set. -type StringValue struct { - v *string -} - -// Merge will overlay this value if it has been set. -func (s *StringValue) Merge(onto *string) { - if s.v != nil { - *onto = *(s.v) - } -} - -// Set implements the flag.Value interface. -func (s *StringValue) Set(v string) error { - if s.v == nil { - s.v = new(string) - } - *(s.v) = v - return nil -} - -// String implements the flag.Value interface. -func (s *StringValue) String() string { - var current string - if s.v != nil { - current = *(s.v) - } - return current -} - -// StringToStringValueFunc is a mapstructure hook that looks for an incoming -// string mapped to a StringValue and does the translation. -func StringToStringValueFunc() mapstructure.DecodeHookFunc { - return func( - f reflect.Type, - t reflect.Type, - data interface{}) (interface{}, error) { - if f.Kind() != reflect.String { - return data, nil - } - - val := StringValue{} - if t != reflect.TypeOf(val) { - return data, nil - } - val.v = new(string) - *(val.v) = data.(string) - return val, nil - } -} - -// UintValue provides a flag value that's aware if it has been set. -type UintValue struct { - v *uint -} - -// Merge will overlay this value if it has been set. -func (u *UintValue) Merge(onto *uint) { - if u.v != nil { - *onto = *(u.v) - } -} - -// Set implements the flag.Value interface. -func (u *UintValue) Set(v string) error { - if u.v == nil { - u.v = new(uint) - } - parsed, err := strconv.ParseUint(v, 0, 64) - *(u.v) = (uint)(parsed) - return err -} - -// String implements the flag.Value interface. -func (u *UintValue) String() string { - var current uint - if u.v != nil { - current = *(u.v) - } - return fmt.Sprintf("%v", current) -} - -// Float64ToUintValueFunc is a mapstructure hook that looks for an incoming -// float64 mapped to a UintValue and does the translation. -func Float64ToUintValueFunc() mapstructure.DecodeHookFunc { - return func( - f reflect.Type, - t reflect.Type, - data interface{}) (interface{}, error) { - if f.Kind() != reflect.Float64 { - return data, nil - } - - val := UintValue{} - if t != reflect.TypeOf(val) { - return data, nil - } - - fv := data.(float64) - if fv < 0 { - return nil, fmt.Errorf("value cannot be negative") - } - - // The standard guarantees at least this, and this is fine for - // values we expect to use in configs vs. being fancy with the - // machine's size for uint. - if fv > (1<<32 - 1) { - return nil, fmt.Errorf("value is too large") - } - - val.v = new(uint) - *(val.v) = (uint)(fv) - return val, nil - } -} - -// VisitFn is a callback that gets a chance to visit each file found during a -// traversal with visit(). -type VisitFn func(path string) error - -// Visit will call the visitor function on the path if it's a file, or for each -// file in the path if it's a directory. Directories will not be recursed into, -// and files in the directory will be visited in alphabetical order. -func Visit(path string, visitor VisitFn) error { - f, err := os.Open(path) - if err != nil { - return fmt.Errorf("error reading %q: %v", path, err) - } - defer f.Close() - - fi, err := f.Stat() - if err != nil { - return fmt.Errorf("error checking %q: %v", path, err) - } - - if !fi.IsDir() { - if err := visitor(path); err != nil { - return fmt.Errorf("error in %q: %v", path, err) - } - return nil - } - - contents, err := f.Readdir(-1) - if err != nil { - return fmt.Errorf("error listing %q: %v", path, err) - } - - sort.Sort(dirEnts(contents)) - for _, fi := range contents { - if fi.IsDir() { - continue - } - - fullPath := filepath.Join(path, fi.Name()) - if err := visitor(fullPath); err != nil { - return fmt.Errorf("error in %q: %v", fullPath, err) - } - } - - return nil -} - -// dirEnts applies sort.Interface to directory entries for sorting by name. -type dirEnts []os.FileInfo - -func (d dirEnts) Len() int { return len(d) } -func (d dirEnts) Less(i, j int) bool { return d[i].Name() < d[j].Name() } -func (d dirEnts) Swap(i, j int) { d[i], d[j] = d[j], d[i] } diff --git a/vendor/github.com/hashicorp/consul/command/flags/flag_map_value.go b/vendor/github.com/hashicorp/consul/command/flags/flag_map_value.go deleted file mode 100644 index aee640b97..000000000 --- a/vendor/github.com/hashicorp/consul/command/flags/flag_map_value.go +++ /dev/null @@ -1,37 +0,0 @@ -package flags - -import ( - "flag" - "fmt" - "strings" -) - -// Ensure implements -var _ flag.Value = (*FlagMapValue)(nil) - -// FlagMapValue is a flag implementation used to provide key=value semantics -// multiple times. -type FlagMapValue map[string]string - -func (h *FlagMapValue) String() string { - return fmt.Sprintf("%v", *h) -} - -func (h *FlagMapValue) Set(value string) error { - idx := strings.Index(value, "=") - if idx == -1 { - return fmt.Errorf("Missing \"=\" value in argument: %s", value) - } - - key, value := value[0:idx], value[idx+1:] - - if *h == nil { - *h = make(map[string]string) - } - - headers := *h - headers[key] = value - *h = headers - - return nil -} diff --git a/vendor/github.com/hashicorp/consul/command/flags/flag_slice_value.go b/vendor/github.com/hashicorp/consul/command/flags/flag_slice_value.go deleted file mode 100644 index a40fd1838..000000000 --- a/vendor/github.com/hashicorp/consul/command/flags/flag_slice_value.go +++ /dev/null @@ -1,20 +0,0 @@ -package flags - -import "strings" - -// AppendSliceValue implements the flag.Value interface and allows multiple -// calls to the same variable to append a list. -type AppendSliceValue []string - -func (s *AppendSliceValue) String() string { - return strings.Join(*s, ",") -} - -func (s *AppendSliceValue) Set(value string) error { - if *s == nil { - *s = make([]string, 0, 1) - } - - *s = append(*s, value) - return nil -} diff --git a/vendor/github.com/hashicorp/consul/command/flags/http.go b/vendor/github.com/hashicorp/consul/command/flags/http.go deleted file mode 100644 index ae2a33113..000000000 --- a/vendor/github.com/hashicorp/consul/command/flags/http.go +++ /dev/null @@ -1,150 +0,0 @@ -package flags - -import ( - "flag" - "io/ioutil" - "strings" - - "github.com/hashicorp/consul/api" -) - -type HTTPFlags struct { - // client api flags - address StringValue - token StringValue - tokenFile StringValue - caFile StringValue - caPath StringValue - certFile StringValue - keyFile StringValue - tlsServerName StringValue - - // server flags - datacenter StringValue - stale BoolValue - - // namespace flags - namespace StringValue -} - -func (f *HTTPFlags) ClientFlags() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - fs.Var(&f.address, "http-addr", - "The `address` and port of the Consul HTTP agent. The value can be an IP "+ - "address or DNS address, but it must also include the port. This can "+ - "also be specified via the CONSUL_HTTP_ADDR environment variable. The "+ - "default value is http://127.0.0.1:8500. The scheme can also be set to "+ - "HTTPS by setting the environment variable CONSUL_HTTP_SSL=true.") - fs.Var(&f.token, "token", - "ACL token to use in the request. This can also be specified via the "+ - "CONSUL_HTTP_TOKEN environment variable. If unspecified, the query will "+ - "default to the token of the Consul agent at the HTTP address.") - fs.Var(&f.tokenFile, "token-file", - "File containing the ACL token to use in the request instead of one specified "+ - "via the -token argument or CONSUL_HTTP_TOKEN environment variable. "+ - "This can also be specified via the CONSUL_HTTP_TOKEN_FILE environment variable.") - fs.Var(&f.caFile, "ca-file", - "Path to a CA file to use for TLS when communicating with Consul. This "+ - "can also be specified via the CONSUL_CACERT environment variable.") - fs.Var(&f.caPath, "ca-path", - "Path to a directory of CA certificates to use for TLS when communicating "+ - "with Consul. This can also be specified via the CONSUL_CAPATH environment variable.") - fs.Var(&f.certFile, "client-cert", - "Path to a client cert file to use for TLS when 'verify_incoming' is enabled. This "+ - "can also be specified via the CONSUL_CLIENT_CERT environment variable.") - fs.Var(&f.keyFile, "client-key", - "Path to a client key file to use for TLS when 'verify_incoming' is enabled. This "+ - "can also be specified via the CONSUL_CLIENT_KEY environment variable.") - fs.Var(&f.tlsServerName, "tls-server-name", - "The server name to use as the SNI host when connecting via TLS. This "+ - "can also be specified via the CONSUL_TLS_SERVER_NAME environment variable.") - return fs -} - -func (f *HTTPFlags) ServerFlags() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - fs.Var(&f.datacenter, "datacenter", - "Name of the datacenter to query. If unspecified, this will default to "+ - "the datacenter of the queried agent.") - fs.Var(&f.stale, "stale", - "Permit any Consul server (non-leader) to respond to this request. This "+ - "allows for lower latency and higher throughput, but can result in "+ - "stale data. This option has no effect on non-read operations. The "+ - "default value is false.") - return fs -} - -func (f *HTTPFlags) NamespaceFlags() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - fs.Var(&f.namespace, "namespace", - "Specifies the namespace to query. If not provided, the namespace will be inferred "+ - "from the request's ACL token, or will default to the `default` namespace. "+ - "Namespaces is a Consul Enterprise feature.") - return fs -} - -func (f *HTTPFlags) Addr() string { - return f.address.String() -} - -func (f *HTTPFlags) Datacenter() string { - return f.datacenter.String() -} - -func (f *HTTPFlags) Stale() bool { - if f.stale.v == nil { - return false - } - return *f.stale.v -} - -func (f *HTTPFlags) Token() string { - return f.token.String() -} - -func (f *HTTPFlags) SetToken(v string) error { - return f.token.Set(v) -} - -func (f *HTTPFlags) TokenFile() string { - return f.tokenFile.String() -} - -func (f *HTTPFlags) SetTokenFile(v string) error { - return f.tokenFile.Set(v) -} - -func (f *HTTPFlags) ReadTokenFile() (string, error) { - tokenFile := f.tokenFile.String() - if tokenFile == "" { - return "", nil - } - - data, err := ioutil.ReadFile(tokenFile) - if err != nil { - return "", err - } - - return strings.TrimSpace(string(data)), nil -} - -func (f *HTTPFlags) APIClient() (*api.Client, error) { - c := api.DefaultConfig() - - f.MergeOntoConfig(c) - - return api.NewClient(c) -} - -func (f *HTTPFlags) MergeOntoConfig(c *api.Config) { - f.address.Merge(&c.Address) - f.token.Merge(&c.Token) - f.tokenFile.Merge(&c.TokenFile) - f.caFile.Merge(&c.TLSConfig.CAFile) - f.caPath.Merge(&c.TLSConfig.CAPath) - f.certFile.Merge(&c.TLSConfig.CertFile) - f.keyFile.Merge(&c.TLSConfig.KeyFile) - f.tlsServerName.Merge(&c.TLSConfig.Address) - f.datacenter.Merge(&c.Datacenter) - f.namespace.Merge(&c.Namespace) -} diff --git a/vendor/github.com/hashicorp/consul/command/flags/merge.go b/vendor/github.com/hashicorp/consul/command/flags/merge.go deleted file mode 100644 index 86b6c774c..000000000 --- a/vendor/github.com/hashicorp/consul/command/flags/merge.go +++ /dev/null @@ -1,15 +0,0 @@ -package flags - -import "flag" - -func Merge(dst, src *flag.FlagSet) { - if dst == nil { - panic("dst cannot be nil") - } - if src == nil { - return - } - src.VisitAll(func(f *flag.Flag) { - dst.Var(f.Value, f.Name, f.Usage) - }) -} diff --git a/vendor/github.com/hashicorp/consul/command/flags/usage.go b/vendor/github.com/hashicorp/consul/command/flags/usage.go deleted file mode 100644 index 646665947..000000000 --- a/vendor/github.com/hashicorp/consul/command/flags/usage.go +++ /dev/null @@ -1,114 +0,0 @@ -package flags - -import ( - "bytes" - "flag" - "fmt" - "io" - "strings" - - text "github.com/kr/text" -) - -func Usage(txt string, flags *flag.FlagSet) string { - u := &Usager{ - Usage: txt, - Flags: flags, - } - return u.String() -} - -type Usager struct { - Usage string - Flags *flag.FlagSet -} - -func (u *Usager) String() string { - out := new(bytes.Buffer) - out.WriteString(strings.TrimSpace(u.Usage)) - out.WriteString("\n") - out.WriteString("\n") - - if u.Flags != nil { - f := &HTTPFlags{} - clientFlags := f.ClientFlags() - serverFlags := f.ServerFlags() - - var httpFlags, cmdFlags *flag.FlagSet - u.Flags.VisitAll(func(f *flag.Flag) { - if contains(clientFlags, f) || contains(serverFlags, f) { - if httpFlags == nil { - httpFlags = flag.NewFlagSet("", flag.ContinueOnError) - } - httpFlags.Var(f.Value, f.Name, f.Usage) - } else { - if cmdFlags == nil { - cmdFlags = flag.NewFlagSet("", flag.ContinueOnError) - } - cmdFlags.Var(f.Value, f.Name, f.Usage) - } - }) - - if httpFlags != nil { - printTitle(out, "HTTP API Options") - httpFlags.VisitAll(func(f *flag.Flag) { - printFlag(out, f) - }) - } - - if cmdFlags != nil { - printTitle(out, "Command Options") - cmdFlags.VisitAll(func(f *flag.Flag) { - printFlag(out, f) - }) - } - } - - return strings.TrimRight(out.String(), "\n") -} - -// printTitle prints a consistently-formatted title to the given writer. -func printTitle(w io.Writer, s string) { - fmt.Fprintf(w, "%s\n\n", s) -} - -// printFlag prints a single flag to the given writer. -func printFlag(w io.Writer, f *flag.Flag) { - example, _ := flag.UnquoteUsage(f) - if example != "" { - fmt.Fprintf(w, " -%s=<%s>\n", f.Name, example) - } else { - fmt.Fprintf(w, " -%s\n", f.Name) - } - - indented := wrapAtLength(f.Usage, 5) - fmt.Fprintf(w, "%s\n\n", indented) -} - -// contains returns true if the given flag is contained in the given flag -// set or false otherwise. -func contains(fs *flag.FlagSet, f *flag.Flag) bool { - if fs == nil { - return false - } - - var in bool - fs.VisitAll(func(hf *flag.Flag) { - in = in || f.Name == hf.Name - }) - return in -} - -// maxLineLength is the maximum width of any line. -const maxLineLength int = 72 - -// wrapAtLength wraps the given text at the maxLineLength, taking into account -// any provided left padding. -func wrapAtLength(s string, pad int) string { - wrapped := text.Wrap(s, maxLineLength-pad) - lines := strings.Split(wrapped, "\n") - for i, line := range lines { - lines[i] = strings.Repeat(" ", pad) + line - } - return strings.Join(lines, "\n") -} diff --git a/vendor/github.com/hashicorp/nomad/api/go.sum b/vendor/github.com/hashicorp/nomad/api/go.sum index d36fa2f71..e723eabc6 100644 --- a/vendor/github.com/hashicorp/nomad/api/go.sum +++ b/vendor/github.com/hashicorp/nomad/api/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -25,15 +24,12 @@ github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8 github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/modules.txt b/vendor/modules.txt index de53d037c..282b08de7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -349,7 +349,6 @@ github.com/grpc-ecosystem/go-grpc-middleware/util/metautils # github.com/hashicorp/consul v1.7.8 ## explicit github.com/hashicorp/consul/agent/consul/autopilot -github.com/hashicorp/consul/command/flags github.com/hashicorp/consul/ipaddr github.com/hashicorp/consul/lib github.com/hashicorp/consul/logging