From 0336d72fcfa54a8e67b0f0d01b72a990a14073c4 Mon Sep 17 00:00:00 2001 From: Tzu-Mainn Chen Date: Fri, 17 Mar 2017 22:30:50 +0100 Subject: [PATCH] Fix general CloudNetwork class_by_ems method --- app/models/cloud_network.rb | 8 ++------ .../providers/openstack/network_manager/cloud_network.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/models/cloud_network.rb b/app/models/cloud_network.rb index 8b4d9f3f487..add916e178d 100644 --- a/app/models/cloud_network.rb +++ b/app/models/cloud_network.rb @@ -39,13 +39,9 @@ class CloudNetwork < ApplicationRecord virtual_total :total_vms, :vms, :uses => :vms - def self.class_by_ems(ext_management_system, external = false) + def self.class_by_ems(ext_management_system, _external = false) # TODO: A factory on ExtManagementSystem to return class for each provider - if external - ext_management_system && ext_management_system.class::CloudNetwork::Public - else - ext_management_system && ext_management_system.class::CloudNetwork::Private - end + ext_management_system && ext_management_system.class::CloudNetwork end private diff --git a/app/models/manageiq/providers/openstack/network_manager/cloud_network.rb b/app/models/manageiq/providers/openstack/network_manager/cloud_network.rb index c40816c4c42..6d0e0eaed64 100644 --- a/app/models/manageiq/providers/openstack/network_manager/cloud_network.rb +++ b/app/models/manageiq/providers/openstack/network_manager/cloud_network.rb @@ -22,6 +22,15 @@ class ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork < ::CloudNetw require_nested :Private require_nested :Public + def self.class_by_ems(ext_management_system, external = false) + # TODO: A factory on ExtManagementSystem to return class for each provider + if external + ext_management_system && ext_management_system.class::CloudNetwork::Public + else + ext_management_system && ext_management_system.class::CloudNetwork::Private + end + end + def self.remapping(options) new_options = options.dup new_options[:router_external] = options[:external_facing] if options[:external_facing]