2015-06-15 01:09:38 -04:00
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
2019-07-02 16:56:28 -04:00
|
|
|
"log"
|
|
|
|
|
2018-01-19 19:18:44 -05:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2015-06-15 01:09:38 -04:00
|
|
|
)
|
|
|
|
|
2019-07-02 16:56:28 -04:00
|
|
|
func commHost(host 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
|
|
|
|
}
|
|
|
|
containerId := state.Get("container_id").(string)
|
|
|
|
driver := state.Get("driver").(Driver)
|
|
|
|
return driver.IPAddress(containerId)
|
|
|
|
}
|
2015-06-15 01:09:38 -04:00
|
|
|
}
|