Class: R10K::Action::Puppetfile::Install

Inherits:
Object
  • Object
show all
Includes:
Logging, Util::Setopts
Defined in:
lib/r10k/action/puppetfile/install.rb

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Method Summary collapse

Methods included from Logging

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

Constructor Details

#initialize(opts, argv) ⇒ Install

Returns a new instance of Install.



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

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

  @ok = true

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

Instance Method Details

#callObject



27
28
29
30
31
# File 'lib/r10k/action/puppetfile/install.rb', line 27

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

#visit(type, other, &block) ⇒ Object



33
34
35
36
37
38
# File 'lib/r10k/action/puppetfile/install.rb', line 33

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

#visit_module(mod) ⇒ Object



46
47
48
49
# File 'lib/r10k/action/puppetfile/install.rb', line 46

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

#visit_puppetfile(pf) ⇒ Object



40
41
42
43
44
# File 'lib/r10k/action/puppetfile/install.rb', line 40

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