class Chef::Resource::File::Verification::Yaml

Extends File verification to provide a Yaml verification

Example: file ‘foo.yaml’ do

content "--- foo: 'foo-"
verify :yaml

end

Public Instance Methods

verify(path, opts = {}) click to toggle source
# File lib/chef/resource/file/verification/yaml.rb, line 41
def verify(path, opts = {})
  Psych.parse(TargetIO::IO.read(path))
  true
rescue Psych::SyntaxError => e
  Chef::Log.error("Yaml syntax verify failed with : #{e.message}")
  false
end