Skip to content

Commit

Permalink
solve inspec#1569
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-exz committed Mar 18, 2017
1 parent bf36c0a commit 4647664
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/inspec/secrets/yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ class YAML < Inspec.secrets(1)
attr_reader :attributes

def self.resolve(target)
unless target.is_a?(String) && File.file?(target) && target.end_with?('.yml')
unless target.is_a?(String) && File.file?(target)
return nil
end
new(target)
end

# array of yaml file paths
def initialize(target)
@attributes = ::YAML.load_file(target)
begin
@attributes = ::YAML.load_file(target)
rescue => e
raise "Error reading Inspec attributes: #{e}"
end
end
end
end

0 comments on commit 4647664

Please sign in to comment.