Sha256: 1f7c27bf5a965acdc6060a728e7e11c5b4a3ef4eb898c715ceeea5d9dd9e7839

Contents?: true

Size: 556 Bytes

Versions: 13

Compression:

Stored size: 556 Bytes

Contents

require 'ipaddress'
module ForemanAnsible
  # Ensures Ansible reports from hosts where the IP was used, are assigned
  # to the right hostname in Foreman
  module AnsibleReportImporter
    extend ActiveSupport::Concern
    included do
      def host
        hostname = name.downcase
        if AnsibleReportScanner.ansible_report?(raw['logs']) &&
           IPAddress.valid?(hostname) &&
           Nic::Interface.find_by(:ip => hostname)
          @host = Nic::Interface.find_by(:ip => hostname).host
        end
        super
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
foreman_ansible-2.2.14 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.13 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.12 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.11 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.10 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.9 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.8 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.7 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.6 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.5 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.4 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.3 app/services/foreman_ansible/ansible_report_importer.rb
foreman_ansible-2.2.2 app/services/foreman_ansible/ansible_report_importer.rb