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

Extend allowed_cloud_network for providers that don't support allowed_ci #197

Merged
merged 1 commit into from
Jan 17, 2018
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 @@ -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