Skip to content

Commit

Permalink
Add a method to process the refesh action for a PhysicalRack
Browse files Browse the repository at this point in the history
  • Loading branch information
felipedf committed May 11, 2018
1 parent 85b25a1 commit 9fa3368
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/models/physical_rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
29 changes: 29 additions & 0 deletions db/fixtures/miq_product_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9fa3368

Please sign in to comment.