From 980841b6c005e4666e6e8cae97cb63a7a4026a0c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 15 Jul 2013 15:56:28 +0900 Subject: [PATCH] builder/amazon/instance: boilerplate --- builder/amazon/instance/builder.go | 37 +++++++++++++++++++++++++ builder/amazon/instance/builder_test.go | 15 ++++++++++ 2 files changed, 52 insertions(+) create mode 100644 builder/amazon/instance/builder.go create mode 100644 builder/amazon/instance/builder_test.go diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go new file mode 100644 index 000000000..ae717ef4e --- /dev/null +++ b/builder/amazon/instance/builder.go @@ -0,0 +1,37 @@ +// The instance package contains a packer.Builder implementation that builds +// AMIs for Amazon EC2 backed by instance storage, as opposed to EBS storage. +package instance + +import ( + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" + "log" +) + +// The unique ID for this builder +const BuilderId = "mitchellh.amazon.instance" + +// Config is the configuration that is chained through the steps and +// settable from the template. +type Config struct { +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) error { + return nil +} + +func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { + return nil, nil +} + +func (b *Builder) Cancel() { + if b.runner != nil { + log.Println("Cancelling the step runner...") + b.runner.Cancel() + } +} diff --git a/builder/amazon/instance/builder_test.go b/builder/amazon/instance/builder_test.go new file mode 100644 index 000000000..ac214051f --- /dev/null +++ b/builder/amazon/instance/builder_test.go @@ -0,0 +1,15 @@ +package instance + +import ( + "github.com/mitchellh/packer/packer" + "testing" +) + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.Builder); !ok { + t.Fatalf("Builder should be a builder") + } +} +