Skip to content

Commit

Permalink
Merge pull request fog#3674 from dhague/use_port_id
Browse files Browse the repository at this point in the history
Fix attach router to also use port id if passed
  • Loading branch information
geemus committed Aug 26, 2015
2 parents 1157dc7 + 2c49864 commit 82e2233
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/fog/openstack/requests/network/add_router_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ module Fog
module Network
class OpenStack
class Real
def add_router_interface(router_id, subnet_id, options = {})
data = {
'subnet_id' => subnet_id,
}
def add_router_interface(router_id, subnet_id_or_options)

if(subnet_id_or_options.is_a? String)
data = {
'subnet_id' => subnet_id_or_options,
}
elsif subnet_id_or_options.is_a? Hash
data = subnet_id_or_options
else
raise ArgumentError,'Please pass a subnet id or hash {subnet_id:xxx,port_id:xxx}'
end


request(
:body => Fog::JSON.encode(data),
Expand Down

0 comments on commit 82e2233

Please sign in to comment.