From 607d2c23f5b6b475a53227c54f6d50baa7e03f3f Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 20 Apr 2018 10:41:15 -0300 Subject: [PATCH] Adjusting ManageIQ core to enable PhysicalChassis API endpoint --- app/models/physical_chassis.rb | 19 ++++++++++++++++++ db/fixtures/miq_product_features.yml | 29 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/app/models/physical_chassis.rb b/app/models/physical_chassis.rb index d07297cc1a7..303dcf159cd 100644 --- a/app/models/physical_chassis.rb +++ b/app/models/physical_chassis.rb @@ -8,4 +8,23 @@ class PhysicalChassis < ApplicationRecord has_one :hardware, :through => :computer_system has_one :asset_detail, :as => :resource, :dependent => :destroy, :inverse_of => false has_many :guest_devices, :through => :hardware + + 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 427780e7da7..6e681f5a7d1 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 Chassis +- :name: Physical Chassis + :description: Everything under Physical Chassis + :feature_type: node + :identifier: physical_chassis + :children: + - :name: View + :description: View Physical Chassis + :feature_type: view + :identifier: physical_chassis_view + :children: + - :name: List + :description: Display Lists of Physical Chassis + :feature_type: view + :identifier: physical_chassis_show_list + - :name: Show + :description: Display Individual Physical Chassis + :feature_type: view + :identifier: physical_chassis_show + - :name: Operate + :description: Perform Operations on Physical Chassis + :feature_type: control + :identifier: physical_chassis_control + :children: + - :name: Refresh + :description: Refresh relationships and power states for all items related to Physical Chassis + :feature_type: control + :identifier: physical_chassis_refresh + # Physical Servers - :name: Physical Servers :description: Everything under Physical Servers