1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

ensure options hash is actually passed to request

This commit is contained in:
Andrew Stangl 2014-03-15 17:00:04 +00:00
parent 98887aa376
commit 74cef02eac
2 changed files with 10 additions and 4 deletions

View file

@ -49,7 +49,7 @@ module Fog
# >> g = AWS.network_interfaces.new(:subnet_id => "subnet-someId", options)
# >> g.save
#
# options is an optional hash which may contain 'PrivateIpAddress', 'Description', 'groupSet'
# options is an optional hash which may contain 'PrivateIpAddress', 'Description', 'GroupSet'
#
# == Returns:
#
@ -58,7 +58,13 @@ module Fog
def save
requires :subnet_id
data = service.create_network_interface(subnet_id).body['networkInterface']
options = {
'PrivateIpAddress' => private_ip_address,
'Description' => description,
'GroupSet' => group_set,
}
options.delete_if {|key, value| value.nil?}
data = service.create_network_interface(subnet_id, options).body['networkInterface']
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
true

View file

@ -12,7 +12,7 @@ module Fog
# * options<~Hash>:
# * PrivateIpAddress<~String> - The private IP address of the network interface
# * Description<~String> - The description of the network interface
# * groupSet<~Array> - The security group IDs for use by the network interface
# * GroupSet<~Array> - The security group IDs for use by the network interface
#
# === Returns
# * response<~Excon::Response>:
@ -70,7 +70,7 @@ module Fog
groups = {}
if options['GroupSet']
options['GroupSet'].each do |group_id|
name = self.data[:security_groups].select { |k,v| v['groupId'] == group_id } .first.first
name = self.data[:security_groups].select { |k,v| v['groupId'] == group_id }.first
if name.nil?
raise Fog::Compute::AWS::Error.new("Unknown security group '#{group_id}' specified")
end