Skip to content

Commit

Permalink
Override CloudManager#network_manager to define type
Browse files Browse the repository at this point in the history
This ensures the network manager created is of the right type.
ensure_network_manager is defined by the child class
  • Loading branch information
kbrock committed Sep 25, 2023
1 parent 07cfd6b commit 269466f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/models/manageiq/providers/vmware/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ class ManageIQ::Providers::Vmware::CloudManager < ManageIQ::Providers::CloudMana
include ManageIQ::Providers::Vmware::CloudManager::ManagerEventsMixin
include HasNetworkManagerMixin

# override the relation defined in HasNetowrkManagerMixin
has_one :network_manager,
:foreign_key => :parent_ems_id,
:class_name => "ManageIQ::Providers::Vmware::NetworkManager",
:autosave => true,
:dependent => :destroy,
:inverse_of => :parent_manager

has_many :orchestration_templates, :foreign_key => :ems_id, :inverse_of => :ext_management_system, :dependent => :destroy
has_many :snapshots, :through => :vms_and_templates

Expand All @@ -22,10 +30,6 @@ class ManageIQ::Providers::Vmware::CloudManager < ManageIQ::Providers::CloudMana
supports :create
supports :catalog

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

def self.ems_type
@ems_type ||= "vmware_cloud".freeze
end
Expand Down

0 comments on commit 269466f

Please sign in to comment.