fixing tests and funky logic 💦

pull/5630/head
John Davies-Colley 9 years ago
parent 0c787ec9df
commit 10aaa49beb

@ -76,7 +76,9 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
c.RunTags = make(map[string]string) c.RunTags = make(map[string]string)
} }
if c.SSHPrivateIp && c.SSHInterface { // Validation
errs := c.Comm.Prepare(ctx)
if c.SSHPrivateIp && c.SSHInterface != "" {
errs = append(errs, errors.New("ssh_interface and ssh_private_ip should not both be specified")) errs = append(errs, errors.New("ssh_interface and ssh_private_ip should not both be specified"))
} }
@ -86,16 +88,14 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
} }
// Valadating ssh_interface // Valadating ssh_interface
if c.SSHInterface != "public_ip" || if c.SSHInterface != "public_ip" &&
c.SSHInterface != "private_ip" || c.SSHInterface != "private_ip" &&
c.SSHInterface != "public_dns" || c.SSHInterface != "public_dns" &&
c.SSHInterface != "private_dns" || c.SSHInterface != "private_dns" &&
c.SSHInterface != "" { c.SSHInterface != "" {
errs = append(errs, errors.New("Unknown interface type: %s", SSHInterface)) errs = append(errs, errors.New(fmt.Sprintf("Unknown interface type: %s", c.SSHInterface)))
} }
// Validation
errs := c.Comm.Prepare(ctx)
if c.SSHKeyPairName != "" { if c.SSHKeyPairName != "" {
if c.Comm.Type == "winrm" && c.Comm.WinRMPassword == "" && c.Comm.SSHPrivateKey == "" { if c.Comm.Type == "winrm" && c.Comm.WinRMPassword == "" && c.Comm.SSHPrivateKey == "" {
errs = append(errs, errors.New("A private_key_file must be provided to retrieve the winrm password when using ssh_keypair_name.")) errs = append(errs, errors.New("A private_key_file must be provided to retrieve the winrm password when using ssh_keypair_name."))

Loading…
Cancel
Save