Fix ssh_host bug in hyper-v builders.
This commit is contained in:
parent
141f3b29f3
commit
cb0011d665
|
@ -1,10 +1,19 @@
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CommHost(state multistep.StateBag) (string, error) {
|
func CommHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
|
return func(state multistep.StateBag) (string, error) {
|
||||||
|
|
||||||
|
if host != "" {
|
||||||
|
log.Println("Using ssh_host value: %s", ipAddress)
|
||||||
|
return host, nil
|
||||||
|
}
|
||||||
|
|
||||||
vmName := state.Get("vmName").(string)
|
vmName := state.Get("vmName").(string)
|
||||||
driver := state.Get("driver").(Driver)
|
driver := state.Get("driver").(Driver)
|
||||||
|
|
||||||
|
@ -20,3 +29,4 @@ func CommHost(state multistep.StateBag) (string, error) {
|
||||||
|
|
||||||
return ip, nil
|
return ip, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -459,7 +459,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
// configure the communicator ssh, winrm
|
// configure the communicator ssh, winrm
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.SSHConfig.Comm,
|
Config: &b.config.SSHConfig.Comm,
|
||||||
Host: hypervcommon.CommHost,
|
Host: hypervcommon.CommHost(b.config.SSHConfig.Comm.SSHHost),
|
||||||
SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -482,7 +482,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
// configure the communicator ssh, winrm
|
// configure the communicator ssh, winrm
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.SSHConfig.Comm,
|
Config: &b.config.SSHConfig.Comm,
|
||||||
Host: hypervcommon.CommHost,
|
Host: hypervcommon.CommHost(b.config.SSHConfig.Comm.SSHHost),
|
||||||
SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue