4.9.2
This commit is contained in:
@@ -397,15 +397,12 @@ func differenceNetwork(oldList, newList []interface{}) (detachMap, changeIpMap,
|
||||
newMap := newNetwork.(map[string]interface{})
|
||||
if newMap["net_type"] == oldMap["net_type"] && newMap["net_id"] == oldMap["net_id"] && newMap["weight"] == oldMap["weight"] && (newMap["mtu"] == oldMap["mtu"] || newMap["mtu"].(int) == 0) {
|
||||
found = true
|
||||
switch {
|
||||
case (newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != ""):
|
||||
if (newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != "") {
|
||||
changeIpMap = append(changeIpMap, newMap)
|
||||
found = true
|
||||
fallthrough
|
||||
case newMap["mac"] != oldMap["mac"] && newMap["mac"].(string) != "":
|
||||
}
|
||||
if newMap["mac"] != oldMap["mac"] && newMap["mac"].(string) != "" {
|
||||
newMap["old_mac"] = oldMap["mac"]
|
||||
changeMacMap = append(changeMacMap, newMap)
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if found {
|
||||
|
||||
@@ -49,30 +49,13 @@ import (
|
||||
func resourceImageCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
log.Debugf("resourceImageCreate: called for image %s", d.Get("name").(string))
|
||||
|
||||
url, urlOk := d.GetOk("url")
|
||||
filePath, fileImageOk := d.GetOk("file_path")
|
||||
|
||||
if !urlOk && !fileImageOk {
|
||||
return diag.Errorf("resourceImageCreate: no valid url or file_path specified")
|
||||
}
|
||||
|
||||
if urlOk && fileImageOk {
|
||||
return diag.Errorf("resourceImageCreate: either url or resource file_path should be specified")
|
||||
}
|
||||
url, _ := d.GetOk("url")
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
syncMode := d.Get("sync_mode").(bool)
|
||||
var imageId uint64
|
||||
|
||||
if fileImageOk {
|
||||
var err error
|
||||
url, err = c.CloudBroker().Image().UploadImageFile(ctx, filePath.(string))
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
if syncMode {
|
||||
req, err := SyncCreateRequest(ctx, d, m, url.(string))
|
||||
if err != nil {
|
||||
|
||||
@@ -1174,15 +1174,9 @@ func resourceImageSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"url": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Required: true,
|
||||
Description: "URL where to download media from",
|
||||
},
|
||||
"file_path": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "path to image file",
|
||||
},
|
||||
"boot_type": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
|
||||
@@ -764,15 +764,12 @@ func differenceNetwork(oldList, newList []interface{}) (detachMap, changeIpMap,
|
||||
newMap := newNetwork.(map[string]interface{})
|
||||
if newMap["net_type"] == oldMap["net_type"] && newMap["net_id"] == oldMap["net_id"] && newMap["weight"] == oldMap["weight"] && (newMap["mtu"] == oldMap["mtu"] || newMap["mtu"].(int) == 0) {
|
||||
found = true
|
||||
switch {
|
||||
case (newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != ""):
|
||||
if (newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != "") {
|
||||
changeIpMap = append(changeIpMap, newMap)
|
||||
found = true
|
||||
fallthrough
|
||||
case newMap["mac"] != oldMap["mac"] && newMap["mac"].(string) != "":
|
||||
}
|
||||
if newMap["mac"] != oldMap["mac"] && newMap["mac"].(string) != "" {
|
||||
newMap["old_mac"] = oldMap["mac"]
|
||||
changeMacMap = append(changeMacMap, newMap)
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if found {
|
||||
|
||||
Reference in New Issue
Block a user