Commit 540fac64 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Allow post-processors in the core configuration

parent e73c2247
......@@ -42,6 +42,7 @@ type config struct {
Builders map[string]string
Commands map[string]string
PostProcessors map[string]string `json:"post-processors"`
Provisioners map[string]string
}
......@@ -94,6 +95,19 @@ func (c *config) LoadHook(name string) (packer.Hook, error) {
return c.pluginClient(name).Hook()
}
// This is a proper packer.PostProcessorFunc that can be used to load
// packer.PostProcessor implementations from defined plugins.
func (c *config) LoadPostProcessor(name string) (packer.PostProcessor, error) {
log.Printf("Loading post-processor: %s", name)
bin, ok := c.PostProcessors[name]
if !ok {
log.Printf("Post-processor not found: %s", name)
return nil, nil
}
return c.pluginClient(bin).PostProcessor()
}
// This is a proper packer.ProvisionerFunc that can be used to load
// packer.Provisioner implementations from defined plugins.
func (c *config) LoadProvisioner(name string) (packer.Provisioner, error) {
......
......@@ -53,6 +53,7 @@ func main() {
envConfig.Components.Builder = config.LoadBuilder
envConfig.Components.Command = config.LoadCommand
envConfig.Components.Hook = config.LoadHook
envConfig.Components.PostProcessor = config.LoadPostProcessor
envConfig.Components.Provisioner = config.LoadProvisioner
env, err := packer.NewEnvironment(envConfig)
......
......@@ -140,6 +140,18 @@ func (c *Client) Hook() (packer.Hook, error) {
return &cmdHook{packrpc.Hook(client), c}, nil
}
// Returns a post-processor implementation that is communicating over
// this client. If the client hasn't been started, this will start it.
func (c *Client) PostProcessor() (packer.PostProcessor, error) {
_, err := c.rpcClient()
if err != nil {
return nil, err
}
// TODO
return nil, nil
}
// Returns a provisioner implementation that is communicating over this
// client. If the client hasn't been started, this will start it.
func (c *Client) Provisioner() (packer.Provisioner, error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment