lib/bolt/module_installer/resolver.rb
# Resolves module specs and returns a Puppetfile object.
#
Resolves module specs and returns a Puppetfile object.
Resolves module specs and returns a Puppetfile object .
def resolve(specs, config = {})
        require 'puppetfile-resolver'
        document   = PuppetfileResolver::Puppetfile::Document.new('')
        unresolved = []
        specs.specs.each do |spec|
          if spec.resolve
            document.add_module(spec.to_resolver_module)
          else
            unresolved << spec
          end
        end
        unless document.valid?
          message = <<~MESSAGE.chomp
            Unable to resolve module specifications:
            #{document.validation_errors.map(&:message).join("\n")}
          MESSAGE
          raise Bolt::Error.new(message, 'bolt/module-resolver-error')
        end
        resolver = PuppetfileResolver::Resolver.new(document, nil)
        begin
          result = resolver.resolve(
            cache:                       nil,
            ui:                          nil,
            allow_missing_modules:       false,
            spec_searcher_configuration: spec_searcher_config(config)
          )
        rescue StandardError => e
          raise Bolt::Error.new(e.message, 'bolt/module-resolver-error')
        end
        generate_puppetfile(specs, result.specifications.values, unresolved)
      end
def resolve ( specs , config = { } ) require 'puppetfile-resolver' document = PuppetfileResolver :: Puppetfile :: Document . new ( '' ) unresolved = [ ] specs . specs . each do | spec | if spec . resolve document . add_module ( spec . to_resolver_module ) else unresolved << spec end end unless document . valid? message = <<~MESSAGE . chomp 
            Unable to resolve module specifications:

             #{ document . validation_errors . map ( & :message ) . join ( "\n" ) } MESSAGE raise Bolt :: Error . new ( message , 'bolt/module-resolver-error' ) end resolver = PuppetfileResolver :: Resolver . new ( document , nil ) begin result = resolver . resolve ( cache : nil , ui : nil , allow_missing_modules : false , spec_searcher_configuration : spec_searcher_config ( config ) ) rescue StandardError => e raise Bolt :: Error . new ( e . message , 'bolt/module-resolver-error' ) end generate_puppetfile ( specs , result . specifications . values , unresolved ) end
Resolves module specs and returns a Puppetfile object.
Resolves module specs and returns a Puppetfile object .
# Build the document model from the specs. # Make sure the document model is valid. # Create the resolver using the Puppetfile model. nil disables Puppet # version restrictions. # Configure and resolve the dependency graph, catching any errors # raised by puppetfile-resolver and re-raising them as Bolt errors. # Create the Puppetfile object.
specs
<not_specific>
config
<not_specific>