class R10K::Action::Puppetfile::Purge

Public Instance Methods

call() click to toggle source
# 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

Private Instance Methods

allowed_initialize_opts() click to toggle source
# File lib/r10k/action/puppetfile/purge.rb, line 31
def allowed_initialize_opts
  super.merge(root: :self, puppetfile: :self, moduledir: :self)
end