Skip to content

Commit

Permalink
Changes get_targets_for_source to use correct params
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Jan 12, 2018
1 parent 0c21f44 commit 59ba714
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def allowed_cloud_subnets(_options = {})
end

def allowed_cloud_networks(_options = {})
source = load_ar_obj(get_source_vm)
targets = get_targets_for_source(source, :cloud_filter, CloudNetwork, 'cloud_network_id')
return {} unless (src = provider_or_tenant_object)
targets = get_targets_for_source(src, :cloud_filter, CloudNetwork, 'cloud_networks')
allowed_ci(:cloud_network, [:availability_zone], targets.map(&:id))
end

Expand Down Expand Up @@ -95,7 +95,6 @@ def availability_zone_to_cloud_network(src)
hash[cn.id] = cn.name
end
else
return {} unless load_ar_obj(src[:ems]).cloud_subnets
load_ar_obj(src[:ems]).cloud_subnets.collect(&:cloud_network).each_with_object({}) do |cn, hash|
hash[cn.id] = cn.name
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

let(:admin) { FactoryGirl.create(:user_with_group) }
let(:ems) { FactoryGirl.create(:ems_cloud) }
let(:network_manager) { FactoryGirl.create(:ems_network, :parent_ems_id => ems.id) }
let(:template) { FactoryGirl.create(:miq_template, :name => "template", :ext_management_system => ems) }
let(:workflow) do
stub_dialog
Expand Down Expand Up @@ -117,7 +118,6 @@
@cs2 = FactoryGirl.create(:cloud_subnet, :cloud_network => @cn1,
:availability_zone => @az2,
:ext_management_system => ems.network_manager)

@ip1 = FactoryGirl.create(:floating_ip, :cloud_network_only => true,
:ext_management_system => ems.network_manager)
@ip2 = FactoryGirl.create(:floating_ip, :cloud_network_only => false,
Expand All @@ -126,6 +126,8 @@

context "#allowed_cloud_networks" do
it "without a zone", :skip_before do
network_manager

expect(workflow.allowed_cloud_networks.length).to be_zero
end

Expand Down

0 comments on commit 59ba714

Please sign in to comment.