mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 08:42:33 -04:00
packer: check API version matches between name/bin
As with the version of the plugin, the API version should also match between the path and the self-reported API version from the describe command. This was not checked before, so users could masquerade a plugin's use of an API version that may be incompatible with Packer. To avoid this problem, we make sure both versions are the same, so that they work as expected.
This commit is contained in:
parent
d7f299886d
commit
0502e09399
1 changed files with 6 additions and 0 deletions
|
|
@ -211,6 +211,12 @@ func (pr Requirement) ListInstallations(opts ListInstallationsOptions) (InstallL
|
|||
log.Printf("invalid plugin pre-release version %q, only development or release binaries are accepted", pluginVersionStr)
|
||||
}
|
||||
|
||||
// Check the API version matches between path and describe
|
||||
if describeInfo.APIVersion != protocolVerionStr {
|
||||
log.Printf("plugin %q reported API version %q while its name implies version %q, ignoring", path, describeInfo.APIVersion, protocolVerionStr)
|
||||
continue
|
||||
}
|
||||
|
||||
// no constraint means always pass, this will happen for implicit
|
||||
// plugin requirements and when we list all plugins.
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue