Merge pull request #7074 from hashicorp/fix_3329
vmware-iso (esxi) Add check that "format" is not being set when remote_type is empty.
This commit is contained in:
commit
0371e2a1b4
|
@ -171,6 +171,7 @@ func TestBuilderPrepare_RemoteType(t *testing.T) {
|
|||
|
||||
// Good
|
||||
config["remote_type"] = ""
|
||||
config["format"] = ""
|
||||
config["remote_host"] = ""
|
||||
config["remote_password"] = ""
|
||||
config["remote_private_key_file"] = ""
|
||||
|
@ -245,6 +246,11 @@ func TestBuilderPrepare_Format(t *testing.T) {
|
|||
for _, format := range goodFormats {
|
||||
// Good
|
||||
config["format"] = format
|
||||
config["remote_type"] = "esx5"
|
||||
config["remote_host"] = "hosty.hostface"
|
||||
config["remote_password"] = "password"
|
||||
config["skip_validate_credentials"] = true
|
||||
|
||||
b = Builder{}
|
||||
warns, err = b.Prepare(config)
|
||||
if len(warns) > 0 {
|
||||
|
|
|
@ -167,7 +167,12 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if c.Format == "" {
|
||||
if c.Format != "" {
|
||||
if c.RemoteType != "esx5" {
|
||||
errs = packer.MultiErrorAppend(errs,
|
||||
fmt.Errorf("format is only valid when RemoteType=esx5"))
|
||||
}
|
||||
} else {
|
||||
c.Format = "ovf"
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,12 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
errs = packer.MultiErrorAppend(errs, err)
|
||||
}
|
||||
|
||||
if c.Format == "" {
|
||||
if c.Format != "" {
|
||||
if c.RemoteType != "esx5" {
|
||||
errs = packer.MultiErrorAppend(errs,
|
||||
fmt.Errorf("format is only valid when RemoteType=esx5"))
|
||||
}
|
||||
} else {
|
||||
c.Format = "ovf"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue