From dd89716ed5add9eaa909d3e87cb771a75ff23523 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 17 Jun 2013 11:56:26 -0700 Subject: [PATCH] packer: An initial PostProcessor interface --- packer/post_processor.go | 17 +++++++++++++++++ packer/template.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packer/post_processor.go diff --git a/packer/post_processor.go b/packer/post_processor.go new file mode 100644 index 000000000..d84d3eafc --- /dev/null +++ b/packer/post_processor.go @@ -0,0 +1,17 @@ +package packer + +// A PostProcessor is responsible for taking an artifact of a build +// and doing some sort of post-processing to turn this into another +// artifact. An example of a post-processor would be something that takes +// the result of a build, compresses it, and returns a new artifact containing +// a single file of the prior artifact compressed. +type PostProcessor interface { + // Configure is responsible for setting up configuration, storing + // the state for later, and returning and errors, such as validation + // errors. + Configure(interface{}) error + + // PostProcess takes a previously created Artifact and produces another + // Artifact. If an error occurs, it should return that error. + PostProcess(Artifact) (Artifact, error) +} diff --git a/packer/template.go b/packer/template.go index fbd6ef5fd..ffc15c97a 100644 --- a/packer/template.go +++ b/packer/template.go @@ -14,7 +14,7 @@ type rawTemplate struct { Builders []map[string]interface{} Hooks map[string][]string Provisioners []map[string]interface{} - Outputs []map[string]interface{} + PostProcessors []map[string]interface{} `json:"post-processors"` } // The Template struct represents a parsed template, parsed into the most