2016-01-11 06:22:41 -05:00
|
|
|
package cloudstack
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2018-01-19 19:18:44 -05:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2016-01-11 06:22:41 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func commHost(state multistep.StateBag) (string, error) {
|
2017-07-26 13:01:12 -04:00
|
|
|
ip, hasIP := state.Get("ipaddress").(string)
|
|
|
|
if !hasIP {
|
2017-07-17 03:05:12 -04:00
|
|
|
return "", fmt.Errorf("Failed to retrieve IP address")
|
|
|
|
}
|
|
|
|
|
|
|
|
return ip, nil
|
|
|
|
}
|
2016-01-11 06:22:41 -05:00
|
|
|
|
2017-07-17 03:05:12 -04:00
|
|
|
func commPort(state multistep.StateBag) (int, error) {
|
|
|
|
commPort, hasPort := state.Get("commPort").(int)
|
|
|
|
if !hasPort {
|
|
|
|
return 0, fmt.Errorf("Failed to retrieve communication port")
|
2016-01-11 06:22:41 -05:00
|
|
|
}
|
|
|
|
|
2017-07-17 03:05:12 -04:00
|
|
|
return commPort, nil
|
2016-01-11 06:22:41 -05:00
|
|
|
}
|