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

Inherits:
Base
  • Object
show all
Defined in:
lib/r10k/action/puppetfile/purge.rb

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Attribute Summary

Attributes inherited from Base

#settings

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Logging

debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level

Constructor Details

This class inherits a constructor from R10K::Action::Base

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/r10k/action/puppetfile/purge.rb', line 11

def call
  options = { basedir: @root }

  options[:moduledir]  = @moduledir  if @moduledir
  options[:puppetfile] = @puppetfile if @puppetfile

  loader = R10K::ModuleLoader::Puppetfile.new(**options)
  loaded_content = loader.load!
  R10K::Util::Cleaner.new(loaded_content[:managed_directories],
                          loaded_content[:desired_contents],
                          loaded_content[:purge_exclusions]).purge!

  true
rescue => e
  logger.error R10K::Errors::Formatting.format_exception(e, @trace)
  false
end