Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how_bolt_resolved_modules #3365

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/bolt/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def install_modules(outputter, force: false, resolve: true)

installer = Bolt::ModuleInstaller.new(outputter, pal)

# GAVIN
installer.install(config.project.modules,
config.project.puppetfile,
config.project.managed_moduledir,
Expand Down
5 changes: 4 additions & 1 deletion lib/bolt/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def execute(options)
#
# FINALIZING SETUP
#

check_gem_install
warn_inventory_overrides_cli(config, options)
submit_screen_view(analytics, config, inventory, options)
Expand Down Expand Up @@ -518,6 +518,7 @@ def execute(options)
plugins: plugins
)

# GAVIN
process_command(application, command, action, options)
ensure
analytics&.finish
Expand All @@ -533,6 +534,7 @@ def execute(options)
# @param options [Hash] The CLI options.
#
private def process_command(app, command, action, options)
# GAVIN
case command
when 'apply'
results = outputter.spin do
Expand Down Expand Up @@ -615,6 +617,7 @@ def execute(options)
app.generate_types
SUCCESS
when 'install'
# GAVIN
ok = outputter.spin { app.install_modules(outputter, **options.slice(:force, :resolve)) }
ok ? SUCCESS : FAILURE
when 'show'
Expand Down
2 changes: 2 additions & 0 deletions lib/bolt/module_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def install(specs, path, moduledir, config = {}, force: false, resolve: true)

# This doesn't use the block as it's more testable to just mock *_spin
@outputter.start_spin
require 'pry-byebug'; binding.pry
puppetfile = Resolver.new.resolve(specs, config)
@outputter.stop_spin

Expand Down Expand Up @@ -189,6 +190,7 @@ def install(specs, path, moduledir, config = {}, force: false, resolve: true)
# Installs the Puppetfile and generates types.
#
def install_puppetfile(path, moduledir, config = {})
require 'pry-byebug'; binding.pry
@outputter.print_action_step("Syncing modules from #{path} to #{moduledir}")
@outputter.start_spin
ok = Installer.new(config).install(path, moduledir)
Expand Down
1 change: 1 addition & 0 deletions lib/bolt/module_installer/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def install(path, moduledir)

settings = R10K::Settings.global_settings.evaluate(@config)
R10K::Initializers::GlobalInitializer.new(settings).call
require 'pry-byebug'; binding.pry
install_action = R10K::Action::Puppetfile::Install.new(r10k_opts, nil, {})

# Override the r10k logger with a proxy to our own logger
Expand Down
4 changes: 4 additions & 0 deletions lib/bolt/module_installer/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Resolver
def resolve(specs, config = {})
require 'puppetfile-resolver'

# GAVIN
# Build the document model from the specs.
document = PuppetfileResolver::Puppetfile::Document.new('')
unresolved = []
Expand Down Expand Up @@ -39,6 +40,7 @@ def resolve(specs, config = {})
# version restrictions.
resolver = PuppetfileResolver::Resolver.new(document, nil)

require 'pry-byebug'; binding.pry
# Configure and resolve the dependency graph, catching any errors
# raised by puppetfile-resolver and re-raising them as Bolt errors.
begin
Expand All @@ -53,6 +55,7 @@ def resolve(specs, config = {})
end

# Create the Puppetfile object.
# GAVIN
generate_puppetfile(specs, result.specifications.values, unresolved)
end

Expand All @@ -70,6 +73,7 @@ def resolve(specs, config = {})
# unresolved specs.
#
private def generate_puppetfile(specs, resolved, unresolved)
require 'pry-byebug'; binding.pry
modules = []

# Convert the resolved specs into Bolt module objects.
Expand Down
Loading