provider/openstack: gophercloud migration: Update openstack_networking_subnet_v2 to correctly handle Gateway IP

This commit is contained in:
Gavin Williams 2016-10-07 15:54:37 +01:00 committed by Joe Topjian
parent 9c856a8f6f
commit 8405a9f118
1 changed files with 10 additions and 1 deletions

View File

@ -39,5 +39,14 @@ type SubnetCreateOpts struct {
// ToSubnetCreateMap casts a CreateOpts struct to a map.
// It overrides subnets.ToSubnetCreateMap to add the ValueSpecs field.
func (opts SubnetCreateOpts) ToSubnetCreateMap() (map[string]interface{}, error) {
return BuildRequest(opts, "subnet")
b, err := BuildRequest(opts, "subnet")
if err != nil {
return nil, err
}
if m := b["subnet"].(map[string]interface{}); m["gateway_ip"] == "" {
m["gateway_ip"] = nil
}
return b, nil
}