|
|
|
|
@ -40,8 +40,6 @@ func retrieveUUID(cs *cloudstack.CloudStackClient, name, value string) (uuid str
|
|
|
|
|
uuid, err = cs.VPC.GetVPCOfferingID(value)
|
|
|
|
|
case "vpc":
|
|
|
|
|
uuid, err = cs.VPC.GetVPCID(value)
|
|
|
|
|
case "template":
|
|
|
|
|
uuid, err = cs.Template.GetTemplateID(value, "executable")
|
|
|
|
|
case "network":
|
|
|
|
|
uuid, err = cs.Network.GetNetworkID(value)
|
|
|
|
|
case "zone":
|
|
|
|
|
@ -71,6 +69,22 @@ func retrieveUUID(cs *cloudstack.CloudStackClient, name, value string) (uuid str
|
|
|
|
|
return uuid, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func retrieveTemplateUUID(cs *cloudstack.CloudStackClient, zoneid, value string) (uuid string, e *retrieveError) {
|
|
|
|
|
// If the supplied value isn't a UUID, try to retrieve the UUID ourselves
|
|
|
|
|
if isUUID(value) {
|
|
|
|
|
return value, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.Printf("[DEBUG] Retrieving UUID of template: %s", value)
|
|
|
|
|
|
|
|
|
|
uuid, err := cs.Template.GetTemplateID(value, "executable", zoneid)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return uuid, &retrieveError{name: "template", value: value, err: err}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return uuid, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func isUUID(s string) bool {
|
|
|
|
|
re := regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`)
|
|
|
|
|
return re.MatchString(s)
|
|
|
|
|
|