Class: Kitchen::Provisioner::Puppet::R10K
- Inherits:
-
Object
- Object
- Kitchen::Provisioner::Puppet::R10K
- Includes:
- Logging
- Defined in:
- lib/kitchen/provisioner/puppet/r10k.rb
Overview
Puppet module resolver that uses R10K and a Puppetfile to calculate # dependencies.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#puppetfile ⇒ Object
readonly
Returns the value of attribute puppetfile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(puppetfile, path, logger = Kitchen.logger) ⇒ R10K
constructor
A new instance of R10K.
- #resolve ⇒ Object
Constructor Details
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
55 56 57 |
# File 'lib/kitchen/provisioner/puppet/r10k.rb', line 55 def logger @logger end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
55 56 57 |
# File 'lib/kitchen/provisioner/puppet/r10k.rb', line 55 def path @path end |
#puppetfile ⇒ Object (readonly)
Returns the value of attribute puppetfile.
55 56 57 |
# File 'lib/kitchen/provisioner/puppet/r10k.rb', line 55 def puppetfile @puppetfile end |
Class Method Details
.load!(logger = Kitchen.logger) ⇒ Object
38 39 40 |
# File 'lib/kitchen/provisioner/puppet/r10k.rb', line 38 def self.load!(logger = Kitchen.logger) load_r10k!(logger) end |
.load_r10k!(logger) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/kitchen/provisioner/puppet/r10k.rb', line 57 def self.load_r10k!(logger) require 'r10k/puppetfile' version = ::R10K::VERSION logger.debug("R10K #{version} library loaded") rescue LoadError => e logger.fatal("The `r10k' gem is missing and must be installed" \ ' or cannot be properly activated. Run' \ ' `gem install r10k` or add the following to your' \ " Gemfile if you are using Bundler: `gem 'r10k'`.") raise UserError, "Could not load or activate R10K (#{e.})" end |
Instance Method Details
#resolve ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/kitchen/provisioner/puppet/r10k.rb', line 42 def resolve version = ::R10K::VERSION info("Resolving module dependencies with R10K-Puppet #{version}...") debug("Using Puppetfile from #{puppetfile}") ::R10K::Git::Cache.settings[:cache_root] = '.r10k/git' ::R10K::Forge::ModuleRelease.settings[:cache_root] = '.r10k/cache' pf = ::R10K::Puppetfile.new("", path, puppetfile) pf.load pf.modules.map(&:sync) end |