cloudstack: Updated after review (2)
This commit is contained in:
parent
2fea167294
commit
858f1227af
|
@ -62,7 +62,14 @@ func (s *stepPrepareConfig) Run(state multistep.StateBag) multistep.StepAction {
|
|||
}
|
||||
}
|
||||
|
||||
if config.PublicIPAddress != "" && !isUUID(config.PublicIPAddress) {
|
||||
if config.PublicIPAddress != "" {
|
||||
if isUUID(config.PublicIPAddress) {
|
||||
ip, _, err := client.Address.GetPublicIpAddressByID(config.PublicIPAddress)
|
||||
if err != nil {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed to retrieve IP address: %s", err))
|
||||
}
|
||||
state.Put("ipaddress", ip.Ipaddress)
|
||||
} else {
|
||||
// Save the public IP address before replacing it with it's UUID.
|
||||
state.Put("ipaddress", config.PublicIPAddress)
|
||||
|
||||
|
@ -84,6 +91,7 @@ func (s *stepPrepareConfig) Run(state multistep.StateBag) multistep.StepAction {
|
|||
config.PublicIPAddress = ipAddrs.PublicIpAddresses[0].Id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !isUUID(config.Network) {
|
||||
config.Network, _, err = client.Network.GetNetworkID(config.Network, cloudstack.WithProject(config.Project))
|
||||
|
|
Loading…
Reference in New Issue