From efa7ec78837573a5f5e5beed6623a8d1f0972276 Mon Sep 17 00:00:00 2001 From: sylviamoss Date: Thu, 3 Dec 2020 18:22:32 +0100 Subject: [PATCH] don't override builder/prov/pproc --- packer/plugin/discover.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packer/plugin/discover.go b/packer/plugin/discover.go index fd636a177..823c186b7 100644 --- a/packer/plugin/discover.go +++ b/packer/plugin/discover.go @@ -37,9 +37,16 @@ func (c *Config) GetPlugins() (packer.MapOfBuilder, packer.MapOfProvisioner, pac // Hence, the priority order is the reverse of the search order - i.e., the // CWD has the highest priority. func (c *Config) Discover() error { - c.builders = packer.MapOfBuilder{} - c.postProcessors = packer.MapOfPostProcessor{} - c.provisioners = packer.MapOfProvisioner{} + if c.builders == nil { + c.builders = packer.MapOfBuilder{} + } + if c.provisioners == nil { + c.provisioners = packer.MapOfProvisioner{} + } + if c.postProcessors == nil { + c.postProcessors = packer.MapOfPostProcessor{} + } + // If we are already inside a plugin process we should not need to // discover anything. if os.Getenv(MagicCookieKey) == MagicCookieValue {