From 2a7c04e51989706ac891c3e411bf281f563a9fad Mon Sep 17 00:00:00 2001 From: Pavel Repin Date: Thu, 2 Feb 2012 12:54:25 -0800 Subject: [PATCH] Nix hardcoded regions: EC2. --- lib/fog/aws/compute.rb | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index ecf547a5e..9ded72494 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -248,8 +248,8 @@ module Fog # # ==== Parameters # * options<~Hash> - config arguments for connection. Defaults to {}. - # * region<~String> - optional region to use, in - # ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-southeast-1'] + # * region<~String> - optional region to use. For instance, + # 'eu-west-1', 'us-east-1', and etc. # * aws_session_token<~String> - when using Session Tokens or Federated Users, a session_token must be presented # # ==== Returns @@ -271,24 +271,7 @@ module Fog @port = endpoint.port @scheme = endpoint.scheme else - @host = options[:host] || case options[:region] - when 'ap-northeast-1' - 'ec2.ap-northeast-1.amazonaws.com' - when 'ap-southeast-1' - 'ec2.ap-southeast-1.amazonaws.com' - when 'eu-west-1' - 'ec2.eu-west-1.amazonaws.com' - when 'us-east-1' - 'ec2.us-east-1.amazonaws.com' - when 'us-west-1' - 'ec2.us-west-1.amazonaws.com' - when 'us-west-2' - 'ec2.us-west-2.amazonaws.com' - when 'sa-east-1' - 'ec2.sa-east-1.amazonaws.com' - else - raise ArgumentError, "Unknown region: #{options[:region].inspect}" - end + @host = options[:host] || "ec2.#{options[:region]}.amazonaws.com" @path = options[:path] || '/' @persistent = options[:persistent] || false @port = options[:port] || 443