2015-06-14 22:09:38 -07:00
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
2019-07-02 13:56:28 -07:00
|
|
|
"log"
|
|
|
|
|
2018-01-19 16:18:44 -08:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2015-06-14 22:09:38 -07:00
|
|
|
)
|
|
|
|
|
2019-07-02 13:56:28 -07:00
|
|
|
func commHost(host string) func(multistep.StateBag) (string, error) {
|
|
|
|
return func(state multistep.StateBag) (string, error) {
|
|
|
|
if host != "" {
|
2020-01-30 15:22:22 -08:00
|
|
|
log.Printf("Using host value: %s", host)
|
2019-07-02 13:56:28 -07:00
|
|
|
return host, nil
|
|
|
|
}
|
|
|
|
containerId := state.Get("container_id").(string)
|
|
|
|
driver := state.Get("driver").(Driver)
|
|
|
|
return driver.IPAddress(containerId)
|
|
|
|
}
|
2015-06-14 22:09:38 -07:00
|
|
|
}
|