fix ssh interface conflict

This commit is contained in:
Megan Marsh 2019-07-18 09:47:15 -07:00
parent 1424f1b564
commit e10b9fb708
4 changed files with 11 additions and 10 deletions

View File

@ -164,7 +164,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
Config: &b.config.RunConfig.Comm, Config: &b.config.RunConfig.Comm,
Host: osccommon.SSHHost( Host: osccommon.SSHHost(
oapiconn, oapiconn,
b.config.Comm.SSHInterface), b.config.SSHInterface),
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
}, },
&common.StepProvision{}, &common.StepProvision{},

View File

@ -187,7 +187,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
Config: &b.config.RunConfig.Comm, Config: &b.config.RunConfig.Comm,
Host: osccommon.SSHHost( Host: osccommon.SSHHost(
oapiconn, oapiconn,
b.config.Comm.SSHInterface), b.config.SSHInterface),
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
}, },
&common.StepProvision{}, &common.StepProvision{},

View File

@ -165,7 +165,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
Config: &b.config.RunConfig.Comm, Config: &b.config.RunConfig.Comm,
Host: osccommon.SSHHost( Host: osccommon.SSHHost(
oapiconn, oapiconn,
b.config.Comm.SSHInterface), b.config.SSHInterface),
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
}, },
&common.StepProvision{}, &common.StepProvision{},

View File

@ -87,7 +87,8 @@ type RunConfig struct {
WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout"` WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout"`
// Communicator settings // Communicator settings
Comm communicator.Config `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"`
SSHInterface string `mapstructure:"ssh_interface"`
} }
func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
@ -113,12 +114,12 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
errs := c.Comm.Prepare(ctx) errs := c.Comm.Prepare(ctx)
// Validating ssh_interface // Validating ssh_interface
if c.Comm.SSHInterface != "public_ip" && if c.SSHInterface != "public_ip" &&
c.Comm.SSHInterface != "private_ip" && c.SSHInterface != "private_ip" &&
c.Comm.SSHInterface != "public_dns" && c.SSHInterface != "public_dns" &&
c.Comm.SSHInterface != "private_dns" && c.SSHInterface != "private_dns" &&
c.Comm.SSHInterface != "" { c.SSHInterface != "" {
errs = append(errs, fmt.Errorf("Unknown interface type: %s", c.Comm.SSHInterface)) errs = append(errs, fmt.Errorf("Unknown interface type: %s", c.SSHInterface))
} }
if c.Comm.SSHKeyPairName != "" { if c.Comm.SSHKeyPairName != "" {