From cf3bae691232b5f628801c7cfb704ce576699642 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Fri, 6 Dec 2024 11:45:34 +0000 Subject: [PATCH] Add changes to show how bolt resolved modules Signed-off-by: Gavin Didrichsen --- lib/bolt/application.rb | 1 + lib/bolt/cli.rb | 5 ++++- lib/bolt/module_installer.rb | 2 ++ lib/bolt/module_installer/installer.rb | 1 + lib/bolt/module_installer/resolver.rb | 4 ++++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/bolt/application.rb b/lib/bolt/application.rb index 3c52a5e114..e36e17c197 100644 --- a/lib/bolt/application.rb +++ b/lib/bolt/application.rb @@ -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, diff --git a/lib/bolt/cli.rb b/lib/bolt/cli.rb index 803cf32a21..ec36eccb7e 100644 --- a/lib/bolt/cli.rb +++ b/lib/bolt/cli.rb @@ -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) @@ -518,6 +518,7 @@ def execute(options) plugins: plugins ) + # GAVIN process_command(application, command, action, options) ensure analytics&.finish @@ -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 @@ -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' diff --git a/lib/bolt/module_installer.rb b/lib/bolt/module_installer.rb index da549273f2..2bb21db87c 100644 --- a/lib/bolt/module_installer.rb +++ b/lib/bolt/module_installer.rb @@ -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 @@ -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) diff --git a/lib/bolt/module_installer/installer.rb b/lib/bolt/module_installer/installer.rb index 09bc9ddfa5..57f6396b17 100644 --- a/lib/bolt/module_installer/installer.rb +++ b/lib/bolt/module_installer/installer.rb @@ -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 diff --git a/lib/bolt/module_installer/resolver.rb b/lib/bolt/module_installer/resolver.rb index 7985b8abb1..546a0beb1c 100644 --- a/lib/bolt/module_installer/resolver.rb +++ b/lib/bolt/module_installer/resolver.rb @@ -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 = [] @@ -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 @@ -53,6 +55,7 @@ def resolve(specs, config = {}) end # Create the Puppetfile object. + # GAVIN generate_puppetfile(specs, result.specifications.values, unresolved) end @@ -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.