Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change get_targets_for_source to use correct params #16811

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, glad you were able to remove this check. 👍

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