Class: R10K::Action::Puppetfile::Purge

Inherits:
Object
  • Object
show all
Includes:
Logging, Util::Setopts
Defined in:
lib/r10k/action/puppetfile/purge.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) ⇒ Purge

Returns a new instance of Purge.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/r10k/action/puppetfile/purge.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
# File 'lib/r10k/action/puppetfile/purge.rb', line 25

def call
  pf = R10K::Puppetfile.new(@root, @moduledir, @path)
  pf.load
  pf.purge!
  true
rescue => e
  logger.error R10K::Errors::Formatting.format_exception(e, opts[:trace])
  false
end