|
|
|
@ -3,6 +3,7 @@ package classic
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/packer/common"
|
|
|
|
"github.com/hashicorp/packer/common"
|
|
|
|
"github.com/hashicorp/packer/helper/communicator"
|
|
|
|
"github.com/hashicorp/packer/helper/communicator"
|
|
|
|
@ -27,6 +28,9 @@ type Config struct {
|
|
|
|
Shape string `mapstructure:"shape"`
|
|
|
|
Shape string `mapstructure:"shape"`
|
|
|
|
SourceImageList string `mapstructure:"source_image_list"`
|
|
|
|
SourceImageList string `mapstructure:"source_image_list"`
|
|
|
|
DestImageList string `mapstructure:"dest_image_list"`
|
|
|
|
DestImageList string `mapstructure:"dest_image_list"`
|
|
|
|
|
|
|
|
// Attributes and Atributes file are both optional and mutually exclusive.
|
|
|
|
|
|
|
|
Attributes string `mapstructure:"attributes"`
|
|
|
|
|
|
|
|
AttributesFile string `mapstructure:"attributes_file"`
|
|
|
|
// Optional; if you don't enter anything, the image list description
|
|
|
|
// Optional; if you don't enter anything, the image list description
|
|
|
|
// will read "Packer-built image list"
|
|
|
|
// will read "Packer-built image list"
|
|
|
|
DestImageListDescription string `mapstructure:"image_description"`
|
|
|
|
DestImageListDescription string `mapstructure:"image_description"`
|
|
|
|
@ -81,9 +85,21 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if c.Attributes != "" && c.AttributesFile != "" {
|
|
|
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("Only one of user_data or user_data_file can be specified."))
|
|
|
|
|
|
|
|
} else if c.AttributesFile != "" {
|
|
|
|
|
|
|
|
if _, err := os.Stat(c.AttributesFile); err != nil {
|
|
|
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("attributes_file not found: %s", c.AttributesFile))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if es := c.Comm.Prepare(&c.ctx); len(es) > 0 {
|
|
|
|
if es := c.Comm.Prepare(&c.ctx); len(es) > 0 {
|
|
|
|
errs = packer.MultiErrorAppend(errs, es...)
|
|
|
|
errs = packer.MultiErrorAppend(errs, es...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.Comm.Type == "winrm" {
|
|
|
|
|
|
|
|
err = fmt.Errorf("winRM is not supported with the oracle-classic builder yet.")
|
|
|
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if errs != nil && len(errs.Errors) > 0 {
|
|
|
|
if errs != nil && len(errs.Errors) > 0 {
|
|
|
|
return nil, errs
|
|
|
|
return nil, errs
|
|
|
|
|