bolt 3.5.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Puppetfile +3 -3
- data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +26 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/containerresult.rb +27 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/resourceinstance.rb +43 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +29 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +34 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +55 -0
- data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +66 -0
- data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +5 -1
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +5 -1
- data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +1 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +9 -3
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +6 -2
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +8 -3
- data/guides/guide.txt +17 -0
- data/guides/links.txt +13 -0
- data/guides/targets.txt +29 -0
- data/guides/transports.txt +23 -0
- data/lib/bolt/analytics.rb +4 -8
- data/lib/bolt/applicator.rb +1 -1
- data/lib/bolt/bolt_option_parser.rb +351 -225
- data/lib/bolt/catalog.rb +2 -1
- data/lib/bolt/cli.rb +122 -55
- data/lib/bolt/config.rb +11 -7
- data/lib/bolt/config/options.rb +41 -9
- data/lib/bolt/config/transport/podman.rb +33 -0
- data/lib/bolt/executor.rb +15 -11
- data/lib/bolt/inventory.rb +5 -4
- data/lib/bolt/inventory/inventory.rb +3 -2
- data/lib/bolt/module_installer/specs/git_spec.rb +10 -6
- data/lib/bolt/outputter/human.rb +194 -79
- data/lib/bolt/outputter/json.rb +10 -4
- data/lib/bolt/pal.rb +45 -0
- data/lib/bolt/pal/yaml_plan/step.rb +4 -2
- data/lib/bolt/plan_creator.rb +2 -2
- data/lib/bolt/plugin.rb +13 -11
- data/lib/bolt/puppetdb/client.rb +54 -0
- data/lib/bolt/result.rb +5 -0
- data/lib/bolt/shell/bash.rb +23 -10
- data/lib/bolt/transport/docker.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +10 -6
- data/lib/bolt/transport/podman.rb +19 -0
- data/lib/bolt/transport/podman/connection.rb +98 -0
- data/lib/bolt/transport/ssh/connection.rb +3 -6
- data/lib/bolt/util.rb +71 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/transport_app.rb +3 -0
- data/lib/bolt_spec/plans/mock_executor.rb +2 -1
- metadata +10 -2
| @@ -39,8 +39,6 @@ module Bolt | |
| 39 39 | 
             
                      end
         | 
| 40 40 | 
             
                    end
         | 
| 41 41 |  | 
| 42 | 
            -
                    PAGEANT_NAME = "Pageant\0".encode(Encoding::UTF_16LE)
         | 
| 43 | 
            -
             | 
| 44 42 | 
             
                    def connect
         | 
| 45 43 | 
             
                      options = {
         | 
| 46 44 | 
             
                        logger: @transport_logger,
         | 
| @@ -115,10 +113,9 @@ module Bolt | |
| 115 113 | 
             
                            options[:use_agent] = false
         | 
| 116 114 | 
             
                          end
         | 
| 117 115 | 
             
                        elsif Bolt::Util.windows?
         | 
| 118 | 
            -
                           | 
| 119 | 
            -
                          #  | 
| 120 | 
            -
                           | 
| 121 | 
            -
                          if @find_window.call(nil, PAGEANT_NAME).to_i == 0
         | 
| 116 | 
            +
                          pageant = Net::SSH::Authentication::Pageant::Win.FindWindow("Pageant", "Pageant")
         | 
| 117 | 
            +
                          # If pageant is not running
         | 
| 118 | 
            +
                          if pageant.to_i == 0
         | 
| 122 119 | 
             
                            @logger.debug { "Disabling use_agent in net-ssh: pageant process not running" }
         | 
| 123 120 | 
             
                            options[:use_agent] = false
         | 
| 124 121 | 
             
                          end
         | 
    
        data/lib/bolt/util.rb
    CHANGED
    
    | @@ -85,6 +85,66 @@ module Bolt | |
| 85 85 | 
             
                    Bolt::Config.user_path && !File.exist?(first_runs_free)
         | 
| 86 86 | 
             
                  end
         | 
| 87 87 |  | 
| 88 | 
            +
                  # If Puppet is loaded, we aleady have the path to the module and should
         | 
| 89 | 
            +
                  # just get it. This takes the path to a file provided by the user and a
         | 
| 90 | 
            +
                  # Puppet Parser scope object and tries to find the file, either as an
         | 
| 91 | 
            +
                  # absolute path or Puppet module syntax lookup. Returns the path to the
         | 
| 92 | 
            +
                  # file if found, or nil.
         | 
| 93 | 
            +
                  #
         | 
| 94 | 
            +
                  def find_file_from_scope(file, scope, fallback = false)
         | 
| 95 | 
            +
                    # If we got an absolute path, just return that.
         | 
| 96 | 
            +
                    return file if Pathname.new(file).absolute?
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                    module_name, file_pattern = Bolt::Util.split_path(file)
         | 
| 99 | 
            +
                    # Get the absolute path to the module root from the scope
         | 
| 100 | 
            +
                    mod_path = scope.compiler.environment.module(module_name)&.path
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                    # Search the module for the file, falling back to new-style paths if enabled.
         | 
| 103 | 
            +
                    find_file_in_module(mod_path, file_pattern, fallback) if mod_path
         | 
| 104 | 
            +
                  end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                  # This method is used by Bolt to find files when provided a
         | 
| 107 | 
            +
                  # module-style path without loading Puppet. It takes the absolute path to
         | 
| 108 | 
            +
                  # the module root and the module-style path minus the module name and
         | 
| 109 | 
            +
                  # searches subdirectories in the module in order of precedence.
         | 
| 110 | 
            +
                  #
         | 
| 111 | 
            +
                  def find_file_in_module(module_path, module_file, fallback = false)
         | 
| 112 | 
            +
                    # If the first part of the path is 'scripts' or 'files', the path may
         | 
| 113 | 
            +
                    # be a new-style file location and should fall back to the new path.
         | 
| 114 | 
            +
                    subdir_or_file = split_path(module_file).first
         | 
| 115 | 
            +
                    case subdir_or_file
         | 
| 116 | 
            +
                      # For any subdirs that may indicate the user passed a new-style path,
         | 
| 117 | 
            +
                      # first look in 'mymod/files/<relative_path>' (old-style) then fall
         | 
| 118 | 
            +
                      # back to 'mymod/<relative_path>' (new-style) if enabled.
         | 
| 119 | 
            +
                    when 'scripts', 'files'
         | 
| 120 | 
            +
                      search_module(module_path, module_file, fallback)
         | 
| 121 | 
            +
                    else
         | 
| 122 | 
            +
                      # If the path definitely isn't new-style, only look in the 'files/'
         | 
| 123 | 
            +
                      # directory.
         | 
| 124 | 
            +
                      search_module(module_path, module_file)
         | 
| 125 | 
            +
                    end
         | 
| 126 | 
            +
                  end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                  # This searches a module for files under 'files/' or 'scripts/',
         | 
| 129 | 
            +
                  # optionally falling back to the new style of file loading. It takes the
         | 
| 130 | 
            +
                  # absolute path to the module root, the relative path provided by the
         | 
| 131 | 
            +
                  # user, and whether to fall back to the new-style script loading if the
         | 
| 132 | 
            +
                  # file isn't found in 'files/'.
         | 
| 133 | 
            +
                  #
         | 
| 134 | 
            +
                  private def search_module(module_path, module_file, fallback = false)
         | 
| 135 | 
            +
                    if File.exist?(File.join(module_path, 'files', module_file))
         | 
| 136 | 
            +
                      File.join(module_path, 'files', module_file)
         | 
| 137 | 
            +
                    elsif File.exist?(File.join(module_path, module_file)) && fallback
         | 
| 138 | 
            +
                      File.join(module_path, module_file)
         | 
| 139 | 
            +
                    end
         | 
| 140 | 
            +
                  end
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                  # Copied directly from puppet/lib/puppet/parser/files.rb
         | 
| 143 | 
            +
                  #
         | 
| 144 | 
            +
                  def split_path(path)
         | 
| 145 | 
            +
                    path.split(File::SEPARATOR, 2)
         | 
| 146 | 
            +
                  end
         | 
| 147 | 
            +
             | 
| 88 148 | 
             
                  # Accepts a path with either 'plans' or 'tasks' in it and determines
         | 
| 89 149 | 
             
                  # the name of the module
         | 
| 90 150 | 
             
                  def module_name(path)
         | 
| @@ -343,6 +403,17 @@ module Bolt | |
| 343 403 | 
             
                    Open3.capture3(env, 'docker', *cmd, { binmode: true })
         | 
| 344 404 | 
             
                  end
         | 
| 345 405 |  | 
| 406 | 
            +
                  # Executes a Podman CLI command. This is useful for running commands as
         | 
| 407 | 
            +
                  # part of this class without having to go through the `execute`
         | 
| 408 | 
            +
                  # function and manage pipes.
         | 
| 409 | 
            +
                  #
         | 
| 410 | 
            +
                  # @param cmd [String] The podman command and arguments to run
         | 
| 411 | 
            +
                  #   e.g. 'cp <src> <dest>' for `podman cp <src> <dest>`
         | 
| 412 | 
            +
                  # @return [String, String, Process::Status] The output of the command: STDOUT, STDERR, Process Status
         | 
| 413 | 
            +
                  def exec_podman(cmd, env = {})
         | 
| 414 | 
            +
                    Open3.capture3(env, 'podman', *cmd, { binmode: true })
         | 
| 415 | 
            +
                  end
         | 
| 416 | 
            +
             | 
| 346 417 | 
             
                  # Formats a map of environment variables to be passed to a command that
         | 
| 347 418 | 
             
                  # accepts repeated `--env` flags
         | 
| 348 419 | 
             
                  #
         | 
    
        data/lib/bolt/version.rb
    CHANGED
    
    
| @@ -703,6 +703,9 @@ module BoltServer | |
| 703 703 | 
             
                      connect_plugin = BoltServer::Plugin::PuppetConnectData.new(body['puppet_connect_data'])
         | 
| 704 704 | 
             
                      plugins = Bolt::Plugin.setup(context[:config], context[:pal], load_plugins: false)
         | 
| 705 705 | 
             
                      plugins.add_plugin(connect_plugin)
         | 
| 706 | 
            +
                      %w[aws_inventory azure_inventory gcloud_inventory].each do |plugin_name|
         | 
| 707 | 
            +
                        plugins.add_module_plugin(plugin_name) if plugins.known_plugin?(plugin_name)
         | 
| 708 | 
            +
                      end
         | 
| 706 709 | 
             
                      inventory = Bolt::Inventory.from_config(context[:config], plugins)
         | 
| 707 710 | 
             
                      target_list = inventory.get_targets('all').map do |targ|
         | 
| 708 711 | 
             
                        targ.to_h.merge({ 'transport' => targ.transport, 'plugin_hooks' => targ.plugin_hooks })
         | 
| @@ -17,13 +17,14 @@ module BoltSpec | |
| 17 17 |  | 
| 18 18 | 
             
                # Nothing on the executor is 'public'
         | 
| 19 19 | 
             
                class MockExecutor
         | 
| 20 | 
            -
                  attr_reader :noop, :error_message, :in_parallel, :transports
         | 
| 20 | 
            +
                  attr_reader :noop, :error_message, :in_parallel, :transports, :future
         | 
| 21 21 | 
             
                  attr_accessor :run_as, :transport_features, :execute_any_plan
         | 
| 22 22 |  | 
| 23 23 | 
             
                  def initialize(modulepath)
         | 
| 24 24 | 
             
                    @noop = false
         | 
| 25 25 | 
             
                    @run_as = nil
         | 
| 26 26 | 
             
                    @in_parallel = false
         | 
| 27 | 
            +
                    @future = {}
         | 
| 27 28 | 
             
                    @error_message = nil
         | 
| 28 29 | 
             
                    @allow_apply = false
         | 
| 29 30 | 
             
                    @modulepath = [modulepath].flatten.map { |path| File.absolute_path(path) }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bolt
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3. | 
| 4 | 
            +
              version: 3.8.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Puppet
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021-03 | 
| 11 | 
            +
            date: 2021-05-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: addressable
         | 
| @@ -414,6 +414,7 @@ files: | |
| 414 414 | 
             
            - bolt-modules/boltlib/lib/puppet/functions/get_target.rb
         | 
| 415 415 | 
             
            - bolt-modules/boltlib/lib/puppet/functions/get_targets.rb
         | 
| 416 416 | 
             
            - bolt-modules/boltlib/lib/puppet/functions/parallelize.rb
         | 
| 417 | 
            +
            - bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb
         | 
| 417 418 | 
             
            - bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb
         | 
| 418 419 | 
             
            - bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb
         | 
| 419 420 | 
             
            - bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb
         | 
| @@ -449,11 +450,15 @@ files: | |
| 449 450 | 
             
            - bolt-modules/prompt/lib/puppet/functions/prompt/menu.rb
         | 
| 450 451 | 
             
            - bolt-modules/system/lib/puppet/functions/system/env.rb
         | 
| 451 452 | 
             
            - exe/bolt
         | 
| 453 | 
            +
            - guides/guide.txt
         | 
| 452 454 | 
             
            - guides/inventory.txt
         | 
| 455 | 
            +
            - guides/links.txt
         | 
| 453 456 | 
             
            - guides/logging.txt
         | 
| 454 457 | 
             
            - guides/module.txt
         | 
| 455 458 | 
             
            - guides/modulepath.txt
         | 
| 456 459 | 
             
            - guides/project.txt
         | 
| 460 | 
            +
            - guides/targets.txt
         | 
| 461 | 
            +
            - guides/transports.txt
         | 
| 457 462 | 
             
            - lib/bolt.rb
         | 
| 458 463 | 
             
            - lib/bolt/analytics.rb
         | 
| 459 464 | 
             
            - lib/bolt/applicator.rb
         | 
| @@ -473,6 +478,7 @@ files: | |
| 473 478 | 
             
            - lib/bolt/config/transport/lxd.rb
         | 
| 474 479 | 
             
            - lib/bolt/config/transport/options.rb
         | 
| 475 480 | 
             
            - lib/bolt/config/transport/orch.rb
         | 
| 481 | 
            +
            - lib/bolt/config/transport/podman.rb
         | 
| 476 482 | 
             
            - lib/bolt/config/transport/remote.rb
         | 
| 477 483 | 
             
            - lib/bolt/config/transport/ssh.rb
         | 
| 478 484 | 
             
            - lib/bolt/config/transport/winrm.rb
         | 
| @@ -564,6 +570,8 @@ files: | |
| 564 570 | 
             
            - lib/bolt/transport/lxd/connection.rb
         | 
| 565 571 | 
             
            - lib/bolt/transport/orch.rb
         | 
| 566 572 | 
             
            - lib/bolt/transport/orch/connection.rb
         | 
| 573 | 
            +
            - lib/bolt/transport/podman.rb
         | 
| 574 | 
            +
            - lib/bolt/transport/podman/connection.rb
         | 
| 567 575 | 
             
            - lib/bolt/transport/remote.rb
         | 
| 568 576 | 
             
            - lib/bolt/transport/simple.rb
         | 
| 569 577 | 
             
            - lib/bolt/transport/ssh.rb
         |