Skip to content

Commit

Permalink
Merge pull request #18633 from agrare/cloud_manager_auth_key_pair_par…
Browse files Browse the repository at this point in the history
…ent_class

Fix Key Pairs from refresh being returned with provider AuthPrivateKeys
  • Loading branch information
Fryguy authored Apr 12, 2019
2 parents 8cf922f + e79e13a commit 3464c46
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/manageiq/providers/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class << model_name
has_many :cloud_object_store_objects, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_services, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_databases, :foreign_key => :ems_id, :dependent => :destroy
has_many :key_pairs, :class_name => "AuthPrivateKey", :as => :resource, :dependent => :destroy
has_many :key_pairs, :class_name => "AuthKeyPair", :as => :resource, :dependent => :destroy
has_many :host_aggregates, :foreign_key => :ems_id, :dependent => :destroy
has_one :source_tenant, :as => :source, :class_name => 'Tenant'
has_many :vm_and_template_labels, :through => :vms_and_templates, :source => :labels
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ManageIQ::Providers::CloudManager::AuthKeyPair < ::AuthPrivateKey
class ManageIQ::Providers::CloudManager::AuthKeyPair < ::Authentication
include AvailabilityMixin

acts_as_miq_taggable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def dest_availability_zone
end

def guest_access_key_pair
@guest_access_key_pair ||= AuthPrivateKey.find_by(:id => get_option(:guest_access_key_pair))
@guest_access_key_pair ||= ManageIQ::Providers::CloudManager::AuthKeyPair.find_by(:id => get_option(:guest_access_key_pair))
end

def security_groups
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
end

it "#allowed_guest_access_key_pairs" do
kp = AuthPrivateKey.create(:name => "auth_1")
ems.key_pairs << kp
kp = ems.key_pairs.create(:name => "auth_1")
expect(workflow.allowed_guest_access_key_pairs).to eq(kp.id => kp.name)
end
end
Expand Down

0 comments on commit 3464c46

Please sign in to comment.