2019-01-23 16:53:41 -05:00
|
|
|
// The bsusurrogate package contains a packer.Builder implementation that
|
|
|
|
// builds a new EBS-backed AMI using an ephemeral instance.
|
|
|
|
package bsusurrogate
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2019-01-28 13:33:28 -05:00
|
|
|
osccommon "github.com/hashicorp/packer/builder/osc/common"
|
2019-01-23 16:53:41 -05:00
|
|
|
"github.com/hashicorp/packer/common"
|
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
|
|
|
"github.com/hashicorp/packer/packer"
|
|
|
|
"github.com/hashicorp/packer/template/interpolate"
|
|
|
|
)
|
|
|
|
|
|
|
|
const BuilderId = "digitalonus.osc.bsusurrogate"
|
|
|
|
|
|
|
|
type Config struct {
|
2019-01-28 13:33:28 -05:00
|
|
|
common.PackerConfig `mapstructure:",squash"`
|
|
|
|
osccommon.AccessConfig `mapstructure:",squash"`
|
2019-01-28 16:24:31 -05:00
|
|
|
osccommon.RunConfig `mapstructure:",squash"`
|
2019-01-28 18:11:57 -05:00
|
|
|
osccommon.BlockDevices `mapstructure:",squash"`
|
2019-01-29 12:27:42 -05:00
|
|
|
osccommon.OMIConfig `mapstructure:",squash"`
|
2019-01-29 12:28:11 -05:00
|
|
|
|
|
|
|
RootDevice RootBlockDevice `mapstructure:"ami_root_device"`
|
|
|
|
|
|
|
|
ctx interpolate.Context
|
2019-01-23 16:53:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type Builder struct {
|
|
|
|
config Config
|
|
|
|
runner multistep.Runner
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|
|
|
log.Println("Preparing Outscale Builder...")
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
|
|
|
|
log.Println("Running Outscale Builder...")
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *Builder) Cancel() {
|
|
|
|
if b.runner != nil {
|
|
|
|
log.Println("Cancelling the step runner...")
|
|
|
|
b.runner.Cancel()
|
|
|
|
}
|
|
|
|
}
|