Class: ForemanDiscovery::FactToCategoryResolver
- Inherits:
-
Object
- Object
- ForemanDiscovery::FactToCategoryResolver
- Includes:
- ActionView::Helpers::NumberHelper
- Defined in:
- app/services/foreman_discovery/fact_to_category_resolver.rb
Constant Summary collapse
- CATEGORIES_NAMES =
[N_("Highlights"), N_("Storage"), N_("Hardware"), N_("Network"), N_("Software"), N_("IPMI"), N_("Miscellaneous")].freeze
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#interfaces ⇒ Object
readonly
Returns the value of attribute interfaces.
Instance Method Summary collapse
-
#initialize(host) ⇒ FactToCategoryResolver
constructor
A new instance of FactToCategoryResolver.
Constructor Details
#initialize(host) ⇒ FactToCategoryResolver
Returns a new instance of FactToCategoryResolver.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/services/foreman_discovery/fact_to_category_resolver.rb', line 15 def initialize(host) categories = %i[highlights storage hardware network software ipmi] @regex_array = categories.map do |category| settings_category = settings_discovery_fact_prefix(category) if settings_category.empty? send(category) else Regexp.new(settings_category) end end @regex_array << false @categories = [] @interfaces = host.interfaces.map do |interface| { identifier: interface["identifier"], type: interface["type"], mac: interface["mac"], ip: interface["ip"] || "N/A", primary: interface["primary"], provision: interface["provision"], } end assign_facts(host) end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
5 6 7 |
# File 'app/services/foreman_discovery/fact_to_category_resolver.rb', line 5 def categories @categories end |
#interfaces ⇒ Object (readonly)
Returns the value of attribute interfaces.
5 6 7 |
# File 'app/services/foreman_discovery/fact_to_category_resolver.rb', line 5 def interfaces @interfaces end |