Parse out -PACKERSPACE- before looking for exec

pull/8542/head
Tommy McNeely 6 years ago
parent 0649c3f7dc
commit 9d85aa36ec

@ -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 == "" {

Loading…
Cancel
Save