Sha256: b8c0c30935ba0abbd0e61f56053d7ff7abdfd34b284df19eca69aef4a85bdcb7

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'r10k/puppetfile'
require 'r10k/errors/formatting'
require 'r10k/action/visitor'
require 'r10k/action/base'
require 'r10k/util/cleaner'

module R10K
  module Action
    module Puppetfile
      class Install < R10K::Action::Base

        def call
          @ok = true
          begin
            pf = R10K::Puppetfile.new(@root,
                                      {moduledir: @moduledir,
                                       puppetfile_path: @puppetfile,
                                       force: @force || false})
            pf.load!
            pf.sync

            R10K::Util::Cleaner.new(pf.managed_directories,
                                    pf.desired_contents,
                                    pf.purge_exclusions).purge!

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

          @ok
        end

        private

        def allowed_initialize_opts
          super.merge(root: :self, puppetfile: :self, moduledir: :self, force: :self )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
r10k-3.11.0 lib/r10k/action/puppetfile/install.rb
r10k-3.10.0 lib/r10k/action/puppetfile/install.rb
r10k-3.9.3 lib/r10k/action/puppetfile/install.rb
r10k-3.9.2 lib/r10k/action/puppetfile/install.rb
r10k-3.9.1 lib/r10k/action/puppetfile/install.rb