Skip to content

Commit

Permalink
Extend allowed_cloud_network method for providers that don't support …
Browse files Browse the repository at this point in the history
…allowed_ci
  • Loading branch information
d-m-u committed Jan 16, 2018
1 parent 5acca17 commit f2cb328
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def allowed_instance_types(_options = {})
end
end

def allowed_cloud_networks(_options = {})
return {} unless (src_obj = provider_or_tenant_object)

src_obj.all_cloud_networks.each_with_object({}) do |cn, hash|
hash[cn.id] = cn.cidr.blank? ? cn.name : "#{cn.name} (#{cn.cidr})"
end
end

def allowed_cloud_tenants(_options = {})
source = load_ar_obj(get_source_vm)
ems = get_targets_for_ems(source, :cloud_filter, CloudTenant, 'cloud_tenants')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@
expect(workflow.allowed_availability_zones).to eq({})
end

it "#allowed_cloud_networks" do
expect(workflow.allowed_cloud_networks).to eq({})
end

it "#allowed_guest_access_key_pairs" do
expect(workflow.allowed_guest_access_key_pairs).to eq({})
end
Expand All @@ -241,6 +245,12 @@
expect(azs.first).to eq([az.id, az.name])
end

it "#allowed_cloud_networks" do
cn = FactoryGirl.create(:cloud_network)
provider.cloud_networks << cn
expect(workflow.allowed_cloud_networks).to eq(cn.id => cn.name)
end

it "#allowed_guest_access_key_pairs" do
kp = AuthPrivateKey.create(:name => "auth_1")
provider.key_pairs << kp
Expand Down

0 comments on commit f2cb328

Please sign in to comment.