Use constant for global resources

pull/3324/head
Hany Fahim 11 years ago
parent 03d7c1fa7d
commit aa950be63b

@ -219,12 +219,12 @@ func resourceCloudStackTemplateRead(d *schema.ResourceData, meta interface{}) er
d.Set("password_enabled", t.Passwordenabled)
d.Set("is_ready", t.Isready)
if t.Zoneid == "" {
d.Set("zone", "-1")
if t.Zoneid == IS_GLOBAL_RESOURCE {
setValueOrUUID(d, "zone", t.Zonename, IS_GLOBAL_RESOURCE)
} else {
setValueOrUUID(d, "zone", t.Zonename, t.Zoneid)
}
setValueOrUUID(d, "os_type", t.Ostypename, t.Ostypeid)
return nil

@ -10,6 +10,8 @@ import (
"github.com/xanzy/go-cloudstack/cloudstack"
)
const IS_GLOBAL_RESOURCE = "-1"
type retrieveError struct {
name string
value string
@ -53,7 +55,7 @@ func retrieveUUID(cs *cloudstack.CloudStackClient, name, value string) (uuid str
case "network":
uuid, err = cs.Network.GetNetworkID(value)
case "zone":
if value == "-1" {
if value == IS_GLOBAL_RESOURCE {
return value, nil
}
uuid, err = cs.Zone.GetZoneID(value)

Loading…
Cancel
Save