Skip to content

Instantly share code, notes, and snippets.

@acidprime
Created November 20, 2014 21:30
Show Gist options
  • Save acidprime/cfea0def7c23ba16969a to your computer and use it in GitHub Desktop.
Save acidprime/cfea0def7c23ba16969a to your computer and use it in GitHub Desktop.
Simple YAML linter for puppet
#!/opt/puppet/bin/ruby
require 'puppet'
require 'yaml'
def yaml_check(file)
YAML.load_file(file)
rescue Exception => err
puts "YAML invalid: #{file}"
puts "ERROR: #{err}"
false
end
path = '/var/opt/lib/pe-puppet/yaml'
Dir.glob(path + '/*/*.yaml').each do |file|
if yaml_check file
puts "#{file} passed"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment