Skip to content

Commit

Permalink
command: plugins install reject non-releases
Browse files Browse the repository at this point in the history
When installing a plugin with packer plugins install --path, we only
accept release versions of a plugin, as otherwise the loading can be
inconsistent if for example a user specifies a required_plugins block in
their template, in which case the plugins will be ignored.

Until we have a simpler loading scheme then, we will reject non-release
versions of plugins to avoid confusion.
  • Loading branch information
lbajolet-hashicorp committed Nov 24, 2023
1 parent 12b9759 commit 7f43b65
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions command/plugins_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ an issue on our Github repo to signal it.`)
}})
}

if strings.Contains(desc.Version, "-") {
return writeDiags(c.Ui, nil, hcl.Diagnostics{&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid version",
Detail: fmt.Sprintf("Packer can only install plugin releases with this command (ex: 1.0.0), the binary's reported version is %q", desc.Version),
}})
}

pluginBinary, err := os.Open(args.PluginPath)
if err != nil {
return writeDiags(c.Ui, nil, hcl.Diagnostics{&hcl.Diagnostic{
Expand Down

0 comments on commit 7f43b65

Please sign in to comment.