Created
January 10, 2013 09:19
-
-
Save dcarley/4500694 to your computer and use it in GitHub Desktop.
puppet/face/parser $confdir
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
Could not parse for environment production: Error converting value for param 'modulepath': Could not find value for $confdir at /Users/dcarley/projects/puppet/manifests/site.pp:17 |
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
require 'puppet/face' | |
desc "Check for puppet syntax errors" | |
task :syntax do | |
puts '---> Checking puppet syntax' | |
def validate_manifest(file) | |
Puppet::Face[:parser, :current].validate(file) | |
end | |
errors = [] | |
matched_files = FileList["manifests/**/*.pp", "modules/**/*.pp"] | |
matched_files.each do |puppet_file| | |
begin | |
validate_manifest(puppet_file) | |
rescue => error | |
errors << error | |
end | |
end | |
fail errors.join("\n") unless errors.empty? | |
end | |
task :default => [:syntax] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment