23 lines
375 B
Go
23 lines
375 B
Go
package common
|
|
|
|
import (
|
|
"github.com/hashicorp/packer/helper/multistep"
|
|
)
|
|
|
|
func CommHost(state multistep.StateBag) (string, error) {
|
|
vmName := state.Get("vmName").(string)
|
|
driver := state.Get("driver").(Driver)
|
|
|
|
mac, err := driver.Mac(vmName)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
ip, err := driver.IpAddress(mac)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return ip, nil
|
|
}
|