Sha256: 552827f108ceab44857ccb1338213868f8fdb590f0c2690092020463fa8b126f

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

require 'openscap_parser/datastream_file'
require 'openscap_parser/tailoring_file'

module Proxy::OpenSCAP
  class ContentParser
    include ::Proxy::Log

    def validate(file_type, scap_file)
      msg = 'Invalid XML format'
      errors = []
      begin
        case file_type
        when 'scap_content'
          ::OpenscapParser::DatastreamFile.new(scap_file)
        when 'tailoring_file'
          ::OpenscapParser::TailoringFile.new(scap_file)
        end
      rescue Nokogiri::XML::SyntaxError => e
        logger.error msg
        logger.error e.backtrace.join("\n")
        errors << msg
      end
      { errors: errors }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smart_proxy_openscap-0.12.0 lib/smart_proxy_openscap/content_parser.rb
smart_proxy_openscap-0.11.1 lib/smart_proxy_openscap/content_parser.rb
smart_proxy_openscap-0.11.0 lib/smart_proxy_openscap/content_parser.rb