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

[aws|elb] Mimic create_load_balancer mock

Mimic behaviour like the real one, as a availability_zones can be nil
and not when mocking.
This commit is contained in:
Jose Luis Salas 2013-12-22 00:25:06 +01:00
parent 71d42d8411
commit 193cb2d6c4

View file

@ -27,7 +27,7 @@ module Fog
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
params.merge!(Fog::AWS.indexed_param('Subnets.member.%d', options[:subnet_ids]))
params.merge!(Fog::AWS.serialize_keys('Scheme', options[:scheme]))
params.merge!(Fog::AWS.indexed_param('SecurityGroups.member.%d', options[:security_groups]))
params.merge!(Fog::AWS.indexed_param('SecurityGroups.member.%d', options[:security_groups]))
listener_protocol = []
listener_lb_port = []
@ -74,7 +74,8 @@ module Fog
dns_name = Fog::AWS::ELB::Mock.dns_name(lb_name, @region)
region = availability_zones ? availability_zones.first.gsub(/[a-z]$/, '') : "us-east-1"
availability_zones = [*availability_zones]
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].detect { |h| h["attributeName"] == "supported-platforms" }["values"]
security_group = if supported_platforms.include?("EC2")
Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:security_groups]['amazon-elb-sg']