Created
November 20, 2014 21:30
-
-
Save acidprime/cfea0def7c23ba16969a to your computer and use it in GitHub Desktop.
Simple YAML linter for puppet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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