flexera-public / right_aws

RightScale Amazon Web Services Ruby Gems
MIT License
451 stars 175 forks source link

RightAws::RightAwsBaseInterface.init Creates bad server URL when specifying other regions #149

Open ge1st opened 11 years ago

ge1st commented 11 years ago

When passing a region to a new interface the the end URL is created with the wrong structure; <region>.<service>.amazonaws.com instead of <service>.<region>.amazon.com as per the given pattern from Amazon (see http://docs.amazonwebservices.com/general/latest/gr/rande.html#elb_region).

The created URL seems to be valid for ec2 endpoints (both patterns work) but not for 'elasticloadbalancing'. Have not check with other services.

elb = RightAws::ElbInterface.new(:id, :key, {:region => "ap-northeast-1"}) I, [2012-11-19T14:18:05.839780 #15549] INFO -- : New RightAws::ElbInterface using shared connections mode => #<RightAws::ElbInterface:0x00000002685e78 @params={:region=>"ap-northeast-1", :server=>"ap-northeast-1.elasticloadbalancing.amazonaws.com", :port=>443, :service=>"/", :protocol=>"https", :host_to_sign=>"ap-northeast-1.elasticloadbalancing.amazonaws.com", :connection_options=>{}, :connections=>:shared, :max_connections=>10, :connection_lifetime=>1200, :api_version=>"2011-04-05"}, aws_access_key_id"...", aws_secret_access_key"...", with_connection_options{}, logger#<Logger:0x00000002685ba8 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x00000002685b80 @datetime_format=nil>, formatternil, logdev#<Logger::LogDevice:0x00000002685b30 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>, mutex#<Logger::LogDevice::LogDeviceMutex:0x00000002685b08 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000002685ab8>, error_handlernil, cache{}, signature_version"2" elb.describe_load_balancers I, [2012-11-19T14:18:13.563528 #15549] INFO -- : Opening new HTTPS connection to ap-northeast-1.elasticloadbalancing.amazonaws.com:443 W, [2012-11-19T14:18:13.756810 #15549] WARN -- : Rightscale::HttpConnection : request failure count: 1, exception: #<SocketError: getaddrinfo: Name or service not known> I, [2012-11-19T14:18:13.757030 #15549] INFO -- : Opening new HTTPS connection to ap-northeast-1.elasticloadbalancing.amazonaws.com:443 W, [2012-11-19T14:18:13.947035 #15549] WARN -- : Rightscale::HttpConnection : request failure count: 2, exception: #<SocketError: getaddrinfo: Name or service not known> I, [2012-11-19T14:18:13.947252 #15549] INFO -- : Opening new HTTPS connection to ap-northeast-1.elasticloadbalancing.amazonaws.com:443 W, [2012-11-19T14:18:14.138015 #15549] WARN -- : Rightscale::HttpConnection : request failure count: 3, exception: #<SocketError: getaddrinfo: Name or service not known> I, [2012-11-19T14:18:14.138232 #15549] INFO -- : Opening new HTTPS connection to ap-northeast-1.elasticloadbalancing.amazonaws.com:443 W, [2012-11-19T14:18:14.328099 #15549] WARN -- : Rightscale::HttpConnection : request failure count: 4, exception: #<SocketError: getaddrinfo: Name or service not known> W, [2012-11-19T14:18:14.328239 #15549] WARN -- : Rightscale::HttpConnection : re-raising same error: ap-northeast-1.elasticloadbalancing.amazonaws.com temporarily unavailable: (getaddrinfo: Name or service not known) -- error count: 4, error age: 0 RightAws::AwsError: ap-northeast-1.elasticloadbalancing.amazonaws.com temporarily unavailable: (getaddrinfo: Name or service not known) from /usr/lib/ruby/gems/1.9.1/gems/right_http_connection-1.3.0/lib/right_http_connection.rb:382:inblock in request' from /usr/lib/ruby/gems/1.9.1/gems/right_http_connection-1.3.0/lib/right_http_connection.rb:364:in loop' from /usr/lib/ruby/gems/1.9.1/gems/right_http_connection-1.3.0/lib/right_http_connection.rb:364:inrequest' from /usr/lib/ruby/gems/1.9.1/gems/right_aws-3.0.4/lib/awsbase/right_awsbase.rb:542:in block in request_info_impl' from /usr/lib/ruby/1.9.1/benchmark.rb:280:inmeasure' from /usr/lib/ruby/gems/1.9.1/gems/right_aws-3.0.4/lib/awsbase/benchmark_fix.rb:30:in add!' from /usr/lib/ruby/gems/1.9.1/gems/right_aws-3.0.4/lib/awsbase/right_awsbase.rb:540:inrequest_info_impl' from /usr/lib/ruby/gems/1.9.1/gems/right_aws-3.0.4/lib/elb/right_elb_interface.rb:111:in request_info' from /usr/lib/ruby/gems/1.9.1/gems/right_aws-3.0.4/lib/awsbase/right_awsbase.rb:576:inrequest_cache_or_info' from /usr/lib/ruby/gems/1.9.1/gems/right_aws-3.0.4/lib/elb/right_elb_interface.rb:170:in describe_load_balancers' from (irb):21 from /usr/bin/irb:12:in

' `