packer-cn/builder/oracle/classic/pv_config.go

41 lines
1.2 KiB
Go
Raw Normal View History

2018-09-12 19:16:08 -04:00
package classic
import (
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate"
)
type PVConfig struct {
// PersistentVolumeSize lets us control the volume size by using persistent boot storage
PersistentVolumeSize int `mapstructure:"persistent_volume_size"`
BuilderImageList string `mapstructure:"builder_image_list"`
BuilderInstallUploadToolCommand string `mapstructure:"builder_install_upload_tool_command"`
BuilderUploadImageCommand string `mapstructure:"builder_upload_image_command"`
/* TODO:
default to OL image
make sure if set then PVS is above
some way to choose which connection to use for master
possible ignore everything for builder and always use SSH keys
*/
}
func (c *PVConfig) Prepare(ctx *interpolate.Context) (errs *packer.MultiError) {
if c.PersistentVolumeSize == 0 {
return nil
}
if c.BuilderUploadImageCommand == "" {
c.BuilderUploadImageCommand = `curl --connect-timeout 5 \
--max-time 3600 \
--retry 5 \
--retry-delay 0 \
-o {{ .DiskImagePath }} \
'...'`
}
/*
errs = packer.MultiErrorAppend(errs,
fmt.Errorf("Persistent storage volumes are only supported on unix, and must use the ssh communicator."))
*/
return
}