mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 08:42:33 -04:00
plugins: reject non-canonical version numbers
If a plugin is installed manually, its version number could be valid but non-canonical (ex: 1.2.3 vs 01.002.0003). Since these two versions refer to the same version, but the looks are different, this may become ambiguous which version should be loaded. To avoid such a situation, we reject explicitely non-canonical version numbers in plugins, but only in path, we're aware that because of metadata, the version from `describe' may already differ from the file name.
This commit is contained in:
parent
208afbebfa
commit
0e6ee70f6f
1 changed files with 5 additions and 0 deletions
|
|
@ -187,6 +187,11 @@ func (pr Requirement) ListInstallations(opts ListInstallationsOptions) (InstallL
|
|||
continue
|
||||
}
|
||||
|
||||
if fmt.Sprintf("v%s", ver.String()) != pluginVersionStr {
|
||||
log.Printf("version %q in path is non canonical, this could introduce ambiguity and is not supported, ignoring it.", pluginVersionStr)
|
||||
continue
|
||||
}
|
||||
|
||||
if ver.Prerelease() != "" && opts.ReleasesOnly {
|
||||
log.Printf("ignoring pre-release plugin %q", path)
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue