mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
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.
This commit is contained in:
parent
682968d0df
commit
a852434410
2 changed files with 11 additions and 0 deletions
|
|
@ -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…
Reference in a new issue