Sha256: 5e6cd22eca542cbe8cd58b2ae3a1a2601e7bacd380bcee195d34ba6e1c5475d7

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

require 'r10k/puppetfile'
require 'r10k/util/setopts'
require 'r10k/errors/formatting'
require 'r10k/logging'

module R10K
  module Action
    module Puppetfile
      class Install
        include R10K::Logging
        include R10K::Util::Setopts

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

          @ok = true

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

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

        def visit(type, other, &block)
          send("visit_#{type}", other, &block)
        rescue => e
          logger.error R10K::Errors::Formatting.format_exception(e, @trace)
          @ok = false
        end

        def visit_puppetfile(pf)
          pf.load!
          yield
          pf.purge!
        end

        def visit_module(mod)
          logger.info "Updating module #{mod.path}"
          mod.sync
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
r10k-2.0.3 lib/r10k/action/puppetfile/install.rb
r10k-2.0.2 lib/r10k/action/puppetfile/install.rb
r10k-2.0.1 lib/r10k/action/puppetfile/install.rb
r10k-2.0.0 lib/r10k/action/puppetfile/install.rb
r10k-1.5.1 lib/r10k/action/puppetfile/install.rb
r10k-1.4.2 lib/r10k/action/puppetfile/install.rb
r10k-1.4.1 lib/r10k/action/puppetfile/install.rb