Sha256: bd2ff43ac0106318c4dee9d56a0bb2a06f4bd4c7c48a5e8655c277678752bff1

Contents?: true

Size: 972 Bytes

Versions: 23

Compression:

Stored size: 972 Bytes

Contents

module PEBuild
  module OnMachine
    # Execute a command on a machine and log output
    #
    # This method invokes the `execute` method of the machine's communicator
    # and logs any resulting output at info level.
    #
    #
    # @param machine [Vagrant::Machine] The Vagrant machine on which to run the
    #   command.
    # @param cmd [String] The command to run.
    # @param options [Hash] Additional options to pass to the `execute` method
    #   of the communicator.
    # @option options [Boolean] :sudo A flag which controls whether the command
    #   is executed with elevated privilages. Defaults to `true`.
    #
    # @return [void]
    def on_machine(machine, cmd, **options)
      options[:sudo] = true unless options.has_key?(:sudo)

      machine.communicate.execute(cmd, options) do |type, data|
        color = (type == :stdout) ? :green : :red
        machine.ui.info(data.chomp, :color => color, :prefix => true)
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
vagrant-pe_build-0.19.2 lib/pe_build/on_machine.rb
vagrant-pe_build-0.19.1 lib/pe_build/on_machine.rb
vagrant-pe_build-0.19.0 lib/pe_build/on_machine.rb
vagrant-pe_build-0.18.2 lib/pe_build/on_machine.rb
vagrant-pe_build-0.18.1 lib/pe_build/on_machine.rb
vagrant-pe_build-0.18.0 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.14 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.13 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.12 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.11 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.10 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.9 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.8 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.7 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.6 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.5 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.4 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.3 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.2 lib/pe_build/on_machine.rb
vagrant-pe_build-0.17.1 lib/pe_build/on_machine.rb