Sha256: b81057cd3fc53c6d0b5619df6576fe7300b502ab10e985c57d33bb6b0b01f88d
Contents?: true
Size: 723 Bytes
Versions: 104
Compression:
Stored size: 723 Bytes
Contents
# encoding: utf-8 require 'yaml' module Secrets class YAML < Inspec.secrets(1) name 'yaml' attr_reader :attributes def self.resolve(target) unless target.is_a?(String) && File.file?(target) && ['.yml', '.yaml'].include?(File.extname(target).downcase) return nil end new(target) end # array of yaml file paths def initialize(target) @attributes = ::YAML.load_file(target) if @attributes == false || !@attributes.is_a?(Hash) Inspec::Log.warn("#{self.class} unable to parse #{target}: invalid YAML or contents is not a Hash") @attributes = nil end rescue => e raise "Error reading Inspec attributes: #{e}" end end end
Version data entries
104 entries across 104 versions & 2 rubygems