Support 'http_host' parameter (fix #184)
This commit is contained in:
parent
9cad0b7b66
commit
be84a39aa0
|
@ -58,7 +58,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
&common.StepWaitForIp{},
|
||||
&communicator.StepConnect{
|
||||
Config: &b.config.Comm,
|
||||
Host: common.CommHost,
|
||||
Host: common.CommHost(b.config.Comm.SSHHost),
|
||||
SSHConfig: common.SshConfig,
|
||||
},
|
||||
&packerCommon.StepProvision{},
|
||||
|
|
|
@ -9,8 +9,14 @@ import (
|
|||
"io/ioutil"
|
||||
)
|
||||
|
||||
func CommHost(state multistep.StateBag) (string, error) {
|
||||
return state.Get("ip").(string), nil
|
||||
func CommHost(host string) func(multistep.StateBag) (string, error) {
|
||||
return func(state multistep.StateBag) (string, error) {
|
||||
if host != "" {
|
||||
return host, nil
|
||||
} else {
|
||||
return state.Get("ip").(string), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func SshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
||||
|
|
|
@ -80,7 +80,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
&common.StepWaitForIp{},
|
||||
&communicator.StepConnect{
|
||||
Config: &b.config.Comm,
|
||||
Host: common.CommHost,
|
||||
Host: common.CommHost(b.config.Comm.SSHHost),
|
||||
SSHConfig: common.SshConfig,
|
||||
},
|
||||
&packerCommon.StepProvision{},
|
||||
|
|
Loading…
Reference in New Issue