From 9fa3368fe39181ee60c0d61d66a3f666b92ee89b Mon Sep 17 00:00:00 2001 From: felipedf Date: Fri, 11 May 2018 14:30:18 -0300 Subject: [PATCH] Add a method to process the refesh action for a PhysicalRack --- app/models/physical_rack.rb | 19 ++++++++++++++++++ db/fixtures/miq_product_features.yml | 29 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/app/models/physical_rack.rb b/app/models/physical_rack.rb index df6ec75d143f..d569fe228833 100644 --- a/app/models/physical_rack.rb +++ b/app/models/physical_rack.rb @@ -3,4 +3,23 @@ class PhysicalRack < ApplicationRecord has_many :physical_chassis, :dependent => :nullify, :inverse_of => :physical_rack has_many :physical_servers, :dependent => :nullify, :inverse_of => :physical_rack + + def my_zone + ems = ext_management_system + ems ? ems.my_zone : MiqServer.my_zone + end + + def refresh_ems + unless ext_management_system + raise _("No Provider defined") + end + unless ext_management_system.has_credentials? + raise _("No Provider credentials defined") + end + unless ext_management_system.authentication_status_ok? + raise _("Provider failed last authentication check") + end + + EmsRefresh.queue_refresh(ext_management_system) + end end diff --git a/db/fixtures/miq_product_features.yml b/db/fixtures/miq_product_features.yml index f5019e13af5e..669865d5055f 100644 --- a/db/fixtures/miq_product_features.yml +++ b/db/fixtures/miq_product_features.yml @@ -5848,6 +5848,35 @@ :feature_type: admin :identifier: ems_physical_infra_new +# Physical Racks +- :name: Physical Racks + :description: Everything under Physical Racks + :feature_type: node + :identifier: physical_rack + :children: + - :name: View + :description: View Physical Rack + :feature_type: view + :identifier: physical_rack_view + :children: + - :name: List + :description: Display Lists of Physical Racks + :feature_type: view + :identifier: physical_rack_show_list + - :name: Show + :description: Display Individual Physical Rack + :feature_type: view + :identifier: physical_rack_show + - :name: Operate + :description: Perform Operations on Physical Racks + :feature_type: control + :identifier: physical_rack_control + :children: + - :name: Refresh + :description: Refresh relationships and power states for all items related to Physical Rack + :feature_type: control + :identifier: physical_rack_refresh + # Physical Switches - :name: Physical Switches :description: Everything under Physical Switches