53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/r10k/cli/puppetfile.rb', line 53
def self.command
@cmd ||= Cri::Command.define do
name 'check'
usage 'check'
summary 'Try and load the Puppetfile to verify the syntax is correct.'
run do |opts,args,cmd|
puppetfile_root = Dir.getwd
puppetfile_path = ENV['PUPPETFILE_DIR']
puppetfile = ENV['PUPPETFILE']
puppetfile = R10K::Puppetfile.new(puppetfile_root, puppetfile_path, puppetfile)
begin
puppetfile.load
rescue SyntaxError, LoadError => e
$stderr.puts "ERROR: Could not parse Puppetfile"
$stderr.puts e.message
if opts[:trace]
$stderr.puts e.backtrace.join("\n")
end
exit 1
end
puts "Syntax OK"
exit 0
end
end
end
|