Skip to content

Commit

Permalink
Add back the missing IP address range in Virtual Private Cloud name.
Browse files Browse the repository at this point in the history
  • Loading branch information
lfu committed Jan 26, 2018
1 parent ec7645f commit 95aa300
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,19 @@ def allowed_ci(ci, relats, filtered_ids = nil)
super(ci, relats, sources, filtered_ids)
end

def cloud_network_display_name(cn)
cn.cidr.blank? ? cn.name : "#{cn.name} (#{cn.cidr})"
end

def availability_zone_to_cloud_network(src)
if src[:availability_zone]
load_ar_obj(src[:availability_zone]).cloud_subnets.each_with_object({}) do |cs, hash|
cn = cs.cloud_network
hash[cn.id] = cn.name
hash[cn.id] = cloud_network_display_name(cn)
end
else
load_ar_obj(src[:ems]).all_cloud_networks.each_with_object({}) do |cn, hash|
hash[cn.id] = cn.name
hash[cn.id] = cloud_network_display_name(cn)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
@az2 = FactoryGirl.create(:availability_zone, :ext_management_system => ems)
@az3 = FactoryGirl.create(:availability_zone, :ext_management_system => ems)

@cn1 = FactoryGirl.create(:cloud_network, :ext_management_system => ems.network_manager)
@cn1 = FactoryGirl.create(:cloud_network, :ext_management_system => ems.network_manager, :cidr => "10.0.0./8")

@cs1 = FactoryGirl.create(:cloud_subnet, :cloud_network => @cn1,
:availability_zone => @az1,
Expand All @@ -149,7 +149,7 @@
it "with a zone" do
workflow.values[:placement_availability_zone] = [@az1.id, @az1.name]
expect(workflow.allowed_cloud_networks.length).to eq(1)
expect(workflow.allowed_cloud_networks).to eq(@cn1.id => @cn1.name)
expect(workflow.allowed_cloud_networks).to eq(@cn1.id => "#{@cn1.name} (#{@cn1.cidr})")
end
end

Expand Down

0 comments on commit 95aa300

Please sign in to comment.