Skip to content

Commit

Permalink
Merge pull request #14552 from Odravison/physical_server_methods
Browse files Browse the repository at this point in the history
Adds physical_server methods to be used by miq-ui
  • Loading branch information
Fryguy authored Apr 17, 2017
2 parents 282426d + 72f61a1 commit a7323ae
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/models/physical_server.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class PhysicalServer < ApplicationRecord
include NewWithTypeStiMixin
include MiqPolicyMixin

acts_as_miq_taggable

Expand All @@ -10,9 +11,25 @@ class PhysicalServer < ApplicationRecord

has_one :host, :inverse_of => :physical_server

VENDOR_TYPES = {
# DB Displayed
"lenovo" => "lenovo",
"unknown" => "Unknown",
nil => "Unknown",
}.freeze

def name_with_details
details % {
:name => name,
}
end

def has_compliance_policies?
_, plist = MiqPolicy.get_policies_for_target(self, "compliance", "physicalserver_compliance_check")
!plist.blank?
end

def label_for_vendor
VENDOR_TYPES[vendor]
end
end

0 comments on commit a7323ae

Please sign in to comment.