Skip to content

Commit

Permalink
Add refresh relationships and power states support to various models
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilda Stastna committed Sep 4, 2018
1 parent e73600d commit 2231676
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def self.api_allowed_attributes

serialize :options

supports :refresh_ems

def hostname_uniqueness_valid?
return unless hostname_required?
return unless hostname.present? # Presence is checked elsewhere
Expand Down
1 change: 1 addition & 0 deletions app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class Host < ApplicationRecord
unsupported_reason_add(:reset, _("The Host has invalid IPMI credentials"))
end
end
supports :refresh_ems

def self.non_clustered
where(:ems_cluster_id => nil)
Expand Down
1 change: 1 addition & 0 deletions app/models/orchestration_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class OrchestrationStack < ApplicationRecord
alias_method :orchestration_stack_outputs, :outputs
alias_method :orchestration_stack_resources, :resources

supports :refresh_ems
supports :retire

def orchestration_stacks
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_chassis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class PhysicalChassis < ApplicationRecord
has_one :asset_detail, :as => :resource, :dependent => :destroy, :inverse_of => false
has_many :guest_devices, :through => :hardware

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class PhysicalRack < ApplicationRecord
has_many :physical_servers, :dependent => :nullify, :inverse_of => :physical_rack
has_many :physical_storages, :dependent => :nullify, :inverse_of => :physical_rack

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class PhysicalServer < ApplicationRecord

has_many :physical_switches, :through => :computer_system, :source => :connected_physical_switches

supports :refresh_ems

def name_with_details
details % {
:name => name,
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class PhysicalStorage < ApplicationRecord

has_many :physical_disks, :dependent => :destroy, :inverse_of => :physical_storage

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class PhysicalSwitch < Switch

alias_attribute :physical_servers, :connected_physical_servers

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
2 changes: 2 additions & 0 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Provider < ApplicationRecord
virtual_column :verify_ssl, :type => :integer
virtual_column :security_protocol, :type => :string

supports :refresh_ems

def self.leaf_subclasses
descendants.select { |d| d.subclasses.empty? }
end
Expand Down

0 comments on commit 2231676

Please sign in to comment.