Signed-off-by: mr.exz <root@exzec.ru>
This commit is contained in:
mr.exz 2017-03-22 08:17:18 +03:00
parent 4647664d56
commit 38c9648eb4

View file

@ -9,7 +9,7 @@ module Secrets
attr_reader :attributes
def self.resolve(target)
unless target.is_a?(String) && File.file?(target)
unless target.is_a?(String) && File.file?(target) && ['.yml', '.yaml'].include?(File.extname(target).downcase)
return nil
end
new(target)
@ -17,11 +17,9 @@ module Secrets
# array of yaml file paths
def initialize(target)
begin
@attributes = ::YAML.load_file(target)
rescue => e
raise "Error reading Inspec attributes: #{e}"
end
@attributes = ::YAML.load_file(target)
rescue => e
raise "Error reading Inspec attributes: #{e}"
end
end
end