Class: R10K::Action::Puppetfile::Check

Inherits:
Object
  • Object
show all
Includes:
Logging, Util::Setopts
Defined in:
lib/r10k/action/puppetfile/check.rb

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Method Summary collapse

Methods included from Logging

formatter, included, level, level=, levels, #logger, #logger_name, outputter, parse_level

Constructor Details

#initialize(opts, argv) ⇒ Check

Returns a new instance of Check.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/r10k/action/puppetfile/check.rb', line 13

def initialize(opts, argv)
  @opts = opts
  @argv = argv

  setopts(opts, {
    :root       => :self,
    :moduledir  => :self,
    :puppetfile => :path,
    :trace      => :self,
  })
end

Instance Method Details

#callObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/r10k/action/puppetfile/check.rb', line 25

def call
  pf = R10K::Puppetfile.new(@root, @moduledir, @path)

  begin
    pf.load
    $stderr.puts "Syntax OK"
    true
  rescue R10K::Error => e
    $stderr.puts R10K::Errors::Formatting.format_exception(e, @trace)
    false
  end
end