acceptance/lib/acceptance/bolt_command_helper.rb
def bolt_command_on(host, command, flags = {}, opts = {})
      bolt_command = command.dup
      flags.each { |k, v| bolt_command << " #{k} #{v}" }

      case host['platform']
      when /windows/
        # Set the PATH environment variable before running the Bolt command. Ideally this
        # would be set during the setup process, but the PATH is not preserved between
        # sessions on the SUT.
        script = <<~PS
          $boltpath = [IO.Path]::Combine($env:ProgramFiles, 'Puppet Labs', 'Bolt', 'bin')
          $env:Path = $boltpath + ";" + $env:Path
          #{bolt_command}
        PS

        execute_powershell_script_on(host, script, opts)
      when /osx/
        # Ensure Bolt runs with UTF-8 under macOS. Otherwise we get issues with
        # UTF-8 content in task results.
        env = 'source /etc/profile  ~/.bash_profile ~/.bash_login ~/.profile && env LANG=en_US.UTF-8'
        on(host, env + ' ' + bolt_command)
      else
        on(host, bolt_command, opts)
      end
    end
# A helper to build a bolt command used in acceptance testing
# @param [Beaker::Host] host the host to execute the command on
# @param [String] command the command to execute on the bolt SUT
# @param [Hash] flags the command flags to append to the command
# @option flags [String] '--targets' the nodes to run on
# @option flags [String] '--user' the user to run the command as
# @option flags [String] '--password' the password for the user
# @option flags [nil] '--no-host-key-check' specify nil to use
# @option flags [nil] '--no-ssl' specify nil to use
# @param [Hash] opts the options hash for this method
A helper to build a bolt command used in acceptance testing
A helper to build a bolt command used in acceptance testing
def bolt_command_on(host, command, flags = {}, opts = {})
      bolt_command = command.dup
      flags.each { |k, v| bolt_command << " #{k} #{v}" }
      case host['platform']
      when /windows/
        script = <<~PS
          $boltpath = [IO.Path]::Combine($env:ProgramFiles, 'Puppet Labs', 'Bolt', 'bin')
          $env:Path = $boltpath + ";" + $env:Path
          #{bolt_command}
        PS
        execute_powershell_script_on(host, script, opts)
      when /osx/
        env = 'source /etc/profile  ~/.bash_profile ~/.bash_login ~/.profile && env LANG=en_US.UTF-8'
        on(host, env + ' ' + bolt_command)
      else
        on(host, bolt_command, opts)
      end
    end
def bolt_command_on ( host , command , flags = { } , opts = { } ) bolt_command = command . dup flags . each { | k , v | bolt_command << " #{k} #{v}" } case host [ 'platform' ] when / windows / script = <<~PS 
          $boltpath = [IO.Path]::Combine($env:ProgramFiles, 'Puppet Labs', 'Bolt', 'bin')
          $env:Path = $boltpath + ";" + $env:Path
           #{ bolt_command } PS execute_powershell_script_on ( host , script , opts ) when / osx / env = 'source /etc/profile  ~/.bash_profile ~/.bash_login ~/.profile && env LANG=en_US.UTF-8' on ( host , env + ' ' + bolt_command ) else on ( host , bolt_command , opts ) end end
A helper to build a bolt command used in acceptance testing
A helper to build a bolt command used in acceptance testing
# Set the PATH environment variable before running the Bolt command. Ideally this # would be set during the setup process, but the PATH is not preserved between # sessions on the SUT. # Ensure Bolt runs with UTF-8 under macOS. Otherwise we get issues with # UTF-8 content in task results.
host
command
flags
'--no-ssl' specify nil to use
' -- no - ssl ' specify nil to use
opts
opts the options hash for this method
opts the options hash for this method