Skip to content

Commit

Permalink
Merge pull request #52 from tumido/remove_regions_from_ems
Browse files Browse the repository at this point in the history
Remove region support
  • Loading branch information
Bronagh Sorota authored Mar 6, 2018
2 parents 7e547f5 + 630418c commit e91c9f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 78 deletions.
19 changes: 11 additions & 8 deletions app/models/manageiq/providers/google/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,24 @@ class ManageIQ::Providers::Google::CloudManager < ManageIQ::Providers::CloudMana
include ManageIQ::Providers::Google::ManagerMixin

supports :provisioning
supports :regions

before_create :ensure_managers
before_update :ensure_managers_zone_and_provider_region
before_update :ensure_managers_zone

def ensure_network_manager
build_network_manager(:type => 'ManageIQ::Providers::Google::NetworkManager') unless network_manager
end

def ensure_managers
ensure_network_manager
network_manager.name = "#{name} Network Manager" if network_manager
ensure_managers_zone
end

def ensure_managers_zone
network_manager.zone_id = zone_id if network_manager
end

def self.ems_type
@ems_type ||= "gce".freeze
end
Expand Down Expand Up @@ -58,12 +67,6 @@ def supports_authentication?(authtype)
supported_auth_types.include?(authtype.to_s)
end

validates :provider_region, :inclusion => {:in => ManageIQ::Providers::Google::Regions.names}

def description
ManageIQ::Providers::Google::Regions.find_by_name(provider_region)[:description]
end

# Operations

def vm_start(vm, _options = {})
Expand Down
4 changes: 0 additions & 4 deletions app/models/manageiq/providers/google/network_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def self.hostname_required?
false
end

def description
ManageIQ::Providers::Google::Regions.find_by_name(provider_region)[:description]
end

def self.display_name(number = 1)
n_('Network Provider (Google)', 'Network Providers (Google)', number)
end
Expand Down
60 changes: 0 additions & 60 deletions app/models/manageiq/providers/google/regions.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
before(:each) do
_guid, _server, zone = EvmSpecHelper.create_guid_miq_server_zone
@google_json_key = "{\n \"type\": \"service_account\",\n \"project_id\": \"civil-tube-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KFbgMPs1\\n7gkUxfxTfseadSgirxPTd0JXTtJjsV8r1Dn3G1VNcxK/3lNrVCAfDNshTVw3pcek\\nRpt4sxCC1cHhgiErvCF8hJ3LRqZdYDWOPBD28JGQgdHuLuwVXfSm51iZj3+fxTDZ\\nHxYh5I6nTwKBgC5hHgVwedXujApNMFaZDMOfgj2ciTiEB7cRksqkky3xbGyzkaAz\\nZeKokWKFq14i4VoBP0zDbXsFqq2ByxWTFtvEZBEXf6XnKZ5LEtFoMwXa6DpYCjs5\\nXMpsYL4shn58WJpTneo7FZV/HDSwO5thw3duFc38bCcLFhaRKM3QRbV5AoGBAIco\\nwmkNYdMCJqqu/y/EBwayhPoP2HPlE1Gaxpt6v/sQClfOgr4ln4vTBRuu4IvPK+ju\\nltzVxpnWzdK9wGQpMONUv9z379utM5HEZSC3QVKlGWwop0bBvshCqPG43RL9pdr1\\nVpjHBc57W3oYLsWQ0NP/GhTIMRoCPdw+4B7VWWOhAoGAYEdx3cnDpPOTH1179GTv\\ny/q1LXvp8nP50HZ1Yc+wAOnifXBKhSTpjDqgru5OiGT7rggzyK0ui3nyfbwM5AH7\\nyQXmt8q0Nnzo8GdL+YKTfGbnmSwDH0SotEeofwruPuxOr7ows6joo283NOugudsx\\nUAa/tB/piHG/VYQ6dxb8zsg=\\n-----END PRIVATE KEY-----\\n\",\n \"client_email\": \"[email protected]\",\n \"client_id\": \"102455136987689387132\",\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/199203428544-compute%40developer.gserviceaccount.com\"\n}\n"
@ems = FactoryGirl.create(:ems_google, :zone => zone, :provider_region => "us-central1")
@ems = FactoryGirl.create(:ems_google, :zone => zone)
@ems.authentications << FactoryGirl.create(:authentication, :userid => "_", :auth_key => @google_json_key)
@ems.update_attributes(:project => "civil-tube-113314")

Expand Down
7 changes: 2 additions & 5 deletions spec/models/manageiq/providers/google/cloud_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,20 @@
expect(ExtManagementSystem.count).to eq(0)
end

it "moves the network_manager to the same zone and provider region as the cloud_manager" do
it "moves the network_manager to the same zone as the cloud_manager" do
zone1 = FactoryGirl.create(:zone)
zone2 = FactoryGirl.create(:zone)

ems = FactoryGirl.create(:ems_google, :zone => zone1, :provider_region => "us-east1")
ems = FactoryGirl.create(:ems_google, :zone => zone1)
expect(ems.network_manager.zone).to eq zone1
expect(ems.network_manager.zone_id).to eq zone1.id
expect(ems.network_manager.provider_region).to eq "us-east1"

ems.zone = zone2
ems.provider_region = "us-central1"
ems.save!
ems.reload

expect(ems.network_manager.zone).to eq zone2
expect(ems.network_manager.zone_id).to eq zone2.id
expect(ems.network_manager.provider_region).to eq "us-central1"
end

context "#connectivity" do
Expand Down

0 comments on commit e91c9f6

Please sign in to comment.