mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-23 18:04:11 -05:00
26 lines
502 B
Go
26 lines
502 B
Go
package triton
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
|
)
|
|
|
|
func commHost(host string) func(multistep.StateBag) (string, error) {
|
|
return func(state multistep.StateBag) (string, error) {
|
|
if host != "" {
|
|
log.Printf("Using host value: %s", host)
|
|
return host, nil
|
|
}
|
|
|
|
driver := state.Get("driver").(Driver)
|
|
machineID := state.Get("machine").(string)
|
|
|
|
machine, err := driver.GetMachineIP(machineID)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return machine, nil
|
|
}
|
|
}
|