Skip to content

Commit

Permalink
B #399: check overcommit not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
treywelsh authored and frousselet committed Jan 26, 2023
1 parent 30a508d commit 8a22f38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ BUG FIXES:
* resources/opennebula_datastore: conditional reading of `datastore` argument from `custom`. (#382)
* resources/opennebula_virtual_network_address_range: modify `hold_ips` content reading and introduce `helds_ips` attribute (#397)
* resources/opennebula_virtual_network: for reservation, fix `type` and `reservation_ar_id` reading. (#397)
* resources/opennebula_host: set overcommit map only when not empty (#399)

DEPRECATION:

Expand Down
4 changes: 3 additions & 1 deletion opennebula/resource_opennebula_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ func resourceOpennebulaHostRead(ctx context.Context, d *schema.ResourceData, met
overcommitMap["memory"] = hostInfos.Share.TotalMem - reservedMem
}

d.Set("overcommit", []map[string]interface{}{overcommitMap})
if len(overcommitMap) > 0 {
d.Set("overcommit", []map[string]interface{}{overcommitMap})
}
}

clusterID := d.Get("cluster_id").(int)
Expand Down

0 comments on commit 8a22f38

Please sign in to comment.