4.6.3
This commit is contained in:
@@ -286,7 +286,7 @@ func flattenComputeDisksDemo(disksList compute.ListComputeDisks, disksBlocks, ex
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenNetwork(interfaces compute.ListInterfaces) []map[string]interface{} {
|
||||
func flattenNetwork(networks []interface{}, interfaces compute.ListInterfaces) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(interfaces))
|
||||
|
||||
for _, network := range interfaces {
|
||||
@@ -295,12 +295,24 @@ func flattenNetwork(interfaces compute.ListInterfaces) []map[string]interface{}
|
||||
"net_type": network.NetType,
|
||||
"ip_address": network.IPAddress,
|
||||
"mac": network.MAC,
|
||||
"weight": flattenNetworkWeight(networks, network.NetID, network.NetType),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenNetworkWeight(networks []interface{}, netID uint64, netType string) int {
|
||||
for _, network := range networks {
|
||||
ns := network.(map[string]interface{})
|
||||
if ns["net_id"].(int) == int(netID) && ns["net_type"].(string) == netType {
|
||||
weight := ns["weight"].(int)
|
||||
return weight
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func findBootDisk(disks compute.ListComputeDisks) *compute.ItemComputeDisk {
|
||||
for _, disk := range disks {
|
||||
if disk.Type == "B" {
|
||||
@@ -408,7 +420,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
d.Set("started", true)
|
||||
}
|
||||
|
||||
d.Set("network", flattenNetwork(computeRec.Interfaces))
|
||||
d.Set("network", flattenNetwork(d.Get("network").(*schema.Set).List(), computeRec.Interfaces))
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user