Merge pull request #8542 from TJM/plugin_logs

Parse out -PACKERSPACE- before looking for exec
This commit is contained in:
Megan Marsh 2020-01-06 14:14:46 -08:00 committed by GitHub
commit d95b0122f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -267,6 +267,14 @@ func (c *config) discoverInternalComponents() error {
func (c *config) pluginClient(path string) *plugin.Client {
originalPath := path
// Check for special case using `packer plugin PLUGIN`
args := []string{}
if strings.Contains(path, PACKERSPACE) {
parts := strings.Split(path, PACKERSPACE)
path = parts[0]
args = parts[1:]
}
// First attempt to find the executable by consulting the PATH.
path, err := exec.LookPath(path)
if err != nil {
@ -282,14 +290,6 @@ func (c *config) pluginClient(path string) *plugin.Client {
}
}
// Check for special case using `packer plugin PLUGIN`
args := []string{}
if strings.Contains(path, PACKERSPACE) {
parts := strings.Split(path, PACKERSPACE)
path = parts[0]
args = parts[1:]
}
// If everything failed, just use the original path and let the error
// bubble through.
if path == "" {