allow ssh_host override for OpenStack

This commit is contained in:
Megan Marsh 2019-07-02 14:00:51 -07:00
parent eb8c74bf85
commit 0cfe8e7070
2 changed files with 7 additions and 0 deletions

View File

@ -133,6 +133,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&communicator.StepConnect{
Config: &b.config.RunConfig.Comm,
Host: CommHost(
b.config.RunConfig.Comm.SSHHost,
computeClient,
b.config.Comm.SSHInterface,
b.config.Comm.SSHIPVersion),

View File

@ -14,10 +14,16 @@ import (
// CommHost looks up the host for the communicator.
func CommHost(
host string,
client *gophercloud.ServiceClient,
sshinterface string,
sshipversion string) func(multistep.StateBag) (string, error) {
return func(state multistep.StateBag) (string, error) {
if host != "" {
log.Printf("Using ssh_host value: %s", host)
return host, nil
}
s := state.Get("server").(*servers.Server)
// If we have a specific interface, try that