Class: ForemanAnsible::StructuredFactImporter

Inherits:
StructuredFactImporter
  • Object
show all
Defined in:
app/services/foreman_ansible/structured_fact_importer.rb

Overview

On 1.13+ , use the parser for structured facts (like Facter 2) that comes from core

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, facts = {}) ⇒ StructuredFactImporter

Returns a new instance of StructuredFactImporter.



15
16
17
18
19
20
21
22
23
# File 'app/services/foreman_ansible/structured_fact_importer.rb', line 15

def initialize(host, facts = {})
  # Try to assign these facts to the correct host as per the facts say
  # If that host isn't created yet, the host parameter will contain it
  @host = Host.find_by(:name => facts[:ansible_facts][:ansible_fqdn] ||
                                facts[:ansible_facts][:fqdn]) ||
          host
  @facts = normalize(facts[:ansible_facts])
  @counters = {}
end

Class Method Details

.authorized_smart_proxy_featuresObject



11
12
13
# File 'app/services/foreman_ansible/structured_fact_importer.rb', line 11

def self.authorized_smart_proxy_features
  'Ansible'
end

Instance Method Details

#fact_name_classObject



7
8
9
# File 'app/services/foreman_ansible/structured_fact_importer.rb', line 7

def fact_name_class
  ForemanAnsible::FactName
end