diff --git a/lib/fog/openstack/requests/network/create_subnet.rb b/lib/fog/openstack/requests/network/create_subnet.rb index 2265de4a2..aad7cef07 100644 --- a/lib/fog/openstack/requests/network/create_subnet.rb +++ b/lib/fog/openstack/requests/network/create_subnet.rb @@ -38,9 +38,9 @@ module Fog 'cidr' => cidr, 'ip_version' => ip_version, 'gateway_ip' => options[:gateway_ip], - 'allocation_pools' => options[:allocation_pools] || [], - 'dns_nameservers' => options[:dns_nameservers] || [], - 'host_routes' => options[:host_routes] || [], + 'allocation_pools' => options[:allocation_pools], + 'dns_nameservers' => options[:dns_nameservers], + 'host_routes' => options[:host_routes], 'enable_dhcp' => options[:enable_dhcp], 'tenant_id' => options[:tenant_id] } diff --git a/lib/fog/openstack/requests/network/update_subnet.rb b/lib/fog/openstack/requests/network/update_subnet.rb index d0e0a9c46..24d87de34 100644 --- a/lib/fog/openstack/requests/network/update_subnet.rb +++ b/lib/fog/openstack/requests/network/update_subnet.rb @@ -26,9 +26,9 @@ module Fog if subnet = list_subnets.body['subnets'].find { |_| _['id'] == subnet_id } subnet['name'] = options[:name] subnet['gateway_ip'] = options[:gateway_ip] - subnet['dns_nameservers'] = options[:dns_nameservers] - subnet['host_routes'] = options[:host_routes] - subnet['allocation_pools'] = options[:allocation_pools] + subnet['dns_nameservers'] = options[:dns_nameservers] || [] + subnet['host_routes'] = options[:host_routes] || [] + subnet['allocation_pools'] = options[:allocation_pools] || [] subnet['enable_dhcp'] = options[:enable_dhcp] response.body = { 'subnet' => subnet } response.status = 200 diff --git a/tests/openstack/requests/network/subnet_tests.rb b/tests/openstack/requests/network/subnet_tests.rb index ada254d39..bb9ac7154 100644 --- a/tests/openstack/requests/network/subnet_tests.rb +++ b/tests/openstack/requests/network/subnet_tests.rb @@ -38,8 +38,8 @@ Shindo.tests('Fog::Network[:openstack] | subnet requests', ['openstack']) do tests('#update_subnet').formats({'subnet' => @subnet_format}) do subnet_id = Fog::Network[:openstack].subnets.all.first.id attributes = {:name => 'subnet_name', :gateway_ip => '10.2.2.1', - :dns_nameservers => [], :host_routes => [], - :enable_dhcp => true} + :allocation_pools => [], :dns_nameservers => [], + :host_routes => [], :enable_dhcp => true} Fog::Network[:openstack].update_subnet(subnet_id, attributes).body end