Sha256: 9f0eaf735d685d1a03bb6ce03443fa14a36dad01783d8f3018b9503be6551a59

Contents?: true

Size: 583 Bytes

Versions: 13

Compression:

Stored size: 583 Bytes

Contents

module ForemanAnsible
  # Scans ConfigReports after import for indicators of an Ansible report and
  # sets the origin of the report to 'Ansible'
  class AnsibleReportScanner
    class << self
      def scan(report, logs)
        if (is_ansible = ansible_report?(logs))
          report.origin = 'Ansible'
        end
        is_ansible
      end

      def ansible_report?(logs)
        return false if logs.blank?
        logs.any? do |log|
          log['log'].fetch('messages', {}).
            fetch('message', '') =~ /"_ansible_parsed"/
        end
      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_scanner.rb
foreman_ansible-2.2.13 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.12 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.11 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.10 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.9 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.8 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.7 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.6 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.5 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.4 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.3 app/services/foreman_ansible/ansible_report_scanner.rb
foreman_ansible-2.2.2 app/services/foreman_ansible/ansible_report_scanner.rb