Skip to content

Instantly share code, notes, and snippets.

@dcarley
Created January 10, 2013 09:19
Show Gist options
  • Save dcarley/4500694 to your computer and use it in GitHub Desktop.
Save dcarley/4500694 to your computer and use it in GitHub Desktop.
puppet/face/parser $confdir
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
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