nwops / puppet-retrospec

The only tool you need to generate puppet code, tests, modules, facts, types, providers, data and everything else.
https://www.retrospec-puppet.com/
GNU Affero General Public License v3.0
137 stars 27 forks source link

tests are not created when manifest is invalid #8

Closed logicminds closed 9 years ago

logicminds commented 9 years ago

Since retrospec doesn't compile the code it has no idea when a manifest is invalid. We should use the puppet parser validate command to validate each manifest before proceding to test creation.

logicminds commented 9 years ago

Something like the following would work.

require 'puppet/face'
files = Dir.glob("#{manifest_dir}/**/*.pp").each do |file|
   begin
      Puppet::Face[:parser, '0.0.1'].validate(file)
    rescue SystemExit => e
       puts "Manifest file :#{file} has errors, please fix"
    end
 end
logicminds commented 9 years ago

fixed in master