mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Merge pull request #94 from mrpoundsign/elb-vpc-region-provisioning
Fix mock VPC ELB creation in regions other than us-east-1
This commit is contained in:
commit
377d74b0ca
1 changed files with 15 additions and 2 deletions
|
@ -74,9 +74,22 @@ module Fog
|
||||||
dns_name = Fog::AWS::ELB::Mock.dns_name(lb_name, @region)
|
dns_name = Fog::AWS::ELB::Mock.dns_name(lb_name, @region)
|
||||||
|
|
||||||
availability_zones = [*availability_zones].compact
|
availability_zones = [*availability_zones].compact
|
||||||
region = availability_zones.empty? ? "us-east-1" : availability_zones.first.gsub(/[a-z]$/, '')
|
|
||||||
supported_platforms = Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:account_attributes].find { |h| h["attributeName"] == "supported-platforms" }["values"]
|
|
||||||
subnet_ids = options[:subnet_ids] || []
|
subnet_ids = options[:subnet_ids] || []
|
||||||
|
region = if availability_zones.any?
|
||||||
|
availability_zones.first.gsub(/[a-z]$/, '')
|
||||||
|
elsif subnet_ids.any?
|
||||||
|
# using Hash here for Rubt 1.8.7 support.
|
||||||
|
Hash[
|
||||||
|
Fog::Compute::AWS::Mock.data.select do |_, region_data|
|
||||||
|
region_data[@aws_access_key_id][:subnets].any? do |region_subnets|
|
||||||
|
subnet_ids.include? region_subnets['subnetId']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
].keys[0]
|
||||||
|
else
|
||||||
|
'us-east-1'
|
||||||
|
end
|
||||||
|
supported_platforms = Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:account_attributes].find { |h| h["attributeName"] == "supported-platforms" }["values"]
|
||||||
subnets = Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:subnets].select {|e| subnet_ids.include?(e["subnetId"]) }
|
subnets = Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:subnets].select {|e| subnet_ids.include?(e["subnetId"]) }
|
||||||
|
|
||||||
# http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html
|
# http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html
|
||||||
|
|
Loading…
Reference in a new issue