packer: fix listing on windows with .exe ext

Listing installed plugins on Windows requires the extension to be set in
the ListOptions, otherwise they are not discovered.

While working on the discovery code, and consolidating it in a single
location, we've forgotten to pass the argument to ListInstallations, so
that makes it impossible to automatically discover installed components
on Windows.

This commit fixes this issue for the plugins required, and the general
discovery process during build/validate.
pull/12984/head
Lucas Bajolet 2 years ago committed by Lucas Bajolet
parent 682968d0df
commit a852434410

@ -83,11 +83,16 @@ func (c *PluginsRequiredCommand) RunContext(buildCtx context.Context, cla *Plugi
return ret
}
ext := ""
if runtime.GOOS == "windows" {
ext = ".exe"
}
opts := plugingetter.ListInstallationsOptions{
PluginDirectory: c.Meta.CoreConfig.Components.PluginConfig.PluginDirectory,
BinaryInstallationOptions: plugingetter.BinaryInstallationOptions{
OS: runtime.GOOS,
ARCH: runtime.GOARCH,
Ext: ext,
APIVersionMajor: pluginsdk.APIVersionMajor,
APIVersionMinor: pluginsdk.APIVersionMinor,
Checksummers: []plugingetter.Checksummer{

@ -75,11 +75,17 @@ func (c *PluginConfig) Discover() error {
c.PluginDirectory, _ = PluginFolder()
}
ext := ""
if runtime.GOOS == "windows" {
ext = ".exe"
}
installations, err := plugingetter.Requirement{}.ListInstallations(plugingetter.ListInstallationsOptions{
PluginDirectory: c.PluginDirectory,
BinaryInstallationOptions: plugingetter.BinaryInstallationOptions{
OS: runtime.GOOS,
ARCH: runtime.GOARCH,
Ext: ext,
APIVersionMajor: pluginsdk.APIVersionMajor,
APIVersionMinor: pluginsdk.APIVersionMinor,
Checksummers: []plugingetter.Checksummer{

Loading…
Cancel
Save