From 0f0041725e7bc88fc5a17e24512b9d68c7197209 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 26 Jun 2013 17:37:46 -0700 Subject: [PATCH] post-processor/vagrant: boilerplate --- plugin/post-processor-vagrant/main.go | 10 +++++++++ post-processor/vagrant/aws.go | 16 +++++++++++++++ post-processor/vagrant/aws_test.go | 15 ++++++++++++++ post-processor/vagrant/post-processor.go | 26 ++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 plugin/post-processor-vagrant/main.go create mode 100644 post-processor/vagrant/aws.go create mode 100644 post-processor/vagrant/aws_test.go create mode 100644 post-processor/vagrant/post-processor.go diff --git a/plugin/post-processor-vagrant/main.go b/plugin/post-processor-vagrant/main.go new file mode 100644 index 000000000..0224d26d1 --- /dev/null +++ b/plugin/post-processor-vagrant/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "github.com/mitchellh/packer/packer/plugin" + "github.com/mitchellh/packer/post-processor/vagrant" +) + +func main() { + plugin.ServePostProcessor(new(vagrant.PostProcessor)) +} diff --git a/post-processor/vagrant/aws.go b/post-processor/vagrant/aws.go new file mode 100644 index 000000000..02de6b53b --- /dev/null +++ b/post-processor/vagrant/aws.go @@ -0,0 +1,16 @@ +package vagrant + +import ( + "github.com/mitchellh/packer/packer" +) + +type AWSBoxPostProcessor struct { +} + +func (p *AWSBoxPostProcessor) Configure(raw interface{}) error { + return nil +} + +func (p *AWSBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (packer.Artifact, error) { + return nil, nil +} diff --git a/post-processor/vagrant/aws_test.go b/post-processor/vagrant/aws_test.go new file mode 100644 index 000000000..318a48213 --- /dev/null +++ b/post-processor/vagrant/aws_test.go @@ -0,0 +1,15 @@ +package vagrant + +import ( + "github.com/mitchellh/packer/packer" + "testing" +) + +func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { + var raw interface{} + raw = &AWSBoxPostProcessor{} + if _, ok := raw.(packer.PostProcessor); !ok { + t.Fatalf("AWS PostProcessor should be a PostProcessor") + } +} + diff --git a/post-processor/vagrant/post-processor.go b/post-processor/vagrant/post-processor.go new file mode 100644 index 000000000..df78753c0 --- /dev/null +++ b/post-processor/vagrant/post-processor.go @@ -0,0 +1,26 @@ +// vagrant implements the packer.PostProcessor interface and adds a +// post-processor that turns artifacts of known builders into Vagrant +// boxes. +package vagrant + +import ( + "github.com/mitchellh/packer/packer" +) + +var builtins = map[string]string{ + "mitchellh.amazonebs": "aws", +} + +type Config struct {} + +type PostProcessor struct { + config Config +} + +func (p *PostProcessor) Configure(raw interface{}) error { + return nil +} + +func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (packer.Artifact, error) { + return nil, nil +}