add -verify-plugins flag to init

This provides the user with the option to disable plugin signature
verification.
This commit is contained in:
James Bardin 2017-06-20 11:46:33 -04:00
parent 13d835f996
commit 0a47228065
1 changed files with 8 additions and 2 deletions

View File

@ -36,6 +36,7 @@ func (c *InitCommand) Run(args []string) int {
var flagBackend, flagGet, flagUpgrade bool var flagBackend, flagGet, flagUpgrade bool
var flagConfigExtra map[string]interface{} var flagConfigExtra map[string]interface{}
var flagPluginPath FlagStringSlice var flagPluginPath FlagStringSlice
var flagVerifyPlugins bool
args = c.Meta.process(args, false) args = c.Meta.process(args, false)
cmdFlags := c.flagSet("init") cmdFlags := c.flagSet("init")
@ -49,6 +50,7 @@ func (c *InitCommand) Run(args []string) int {
cmdFlags.BoolVar(&c.reconfigure, "reconfigure", false, "reconfigure") cmdFlags.BoolVar(&c.reconfigure, "reconfigure", false, "reconfigure")
cmdFlags.BoolVar(&flagUpgrade, "upgrade", false, "") cmdFlags.BoolVar(&flagUpgrade, "upgrade", false, "")
cmdFlags.Var(&flagPluginPath, "plugin-dir", "plugin directory") cmdFlags.Var(&flagPluginPath, "plugin-dir", "plugin directory")
cmdFlags.BoolVar(&flagVerifyPlugins, "verify-plugins", true, "verify plugins")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {
@ -64,8 +66,8 @@ func (c *InitCommand) Run(args []string) int {
if c.providerInstaller == nil { if c.providerInstaller == nil {
c.providerInstaller = &discovery.ProviderInstaller{ c.providerInstaller = &discovery.ProviderInstaller{
Dir: c.pluginDir(), Dir: c.pluginDir(),
PluginProtocolVersion: plugin.Handshake.ProtocolVersion, PluginProtocolVersion: plugin.Handshake.ProtocolVersion,
SkipVerify: !flagVerifyPlugins,
} }
} }
@ -383,11 +385,15 @@ Options:
automatic installation of plugins. This flag can be used automatic installation of plugins. This flag can be used
multiple times. multiple times.
-reconfigure Reconfigure the backend, ignoring any saved configuration. -reconfigure Reconfigure the backend, ignoring any saved
configuration.
-upgrade=false If installing modules (-get) or plugins (-get-plugins), -upgrade=false If installing modules (-get) or plugins (-get-plugins),
ignore previously-downloaded objects and install the ignore previously-downloaded objects and install the
latest version allowed within configured constraints. latest version allowed within configured constraints.
-verify-plugins=true Verify the authenticity and integrity of automatically
downloaded plugins.
` `
return strings.TrimSpace(helpText) return strings.TrimSpace(helpText)
} }