Module: PEBuild::OnMachine
- Included in:
- Cap::RunInstall::POSIX, Cap::RunInstall::Windows, Cap::StageInstaller::POSIX, Cap::StageInstaller::Windows, Provisioner::PEBootstrap::PostInstall
- Defined in:
- lib/pe_build/on_machine.rb
Instance Method Summary collapse
-
#on_machine(machine, cmd, **options) ⇒ void
Execute a command on a machine and log output.
Instance Method Details
#on_machine(machine, cmd, **options) ⇒ void
This method returns an undefined value.
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.
18 19 20 21 22 23 24 25 |
# File 'lib/pe_build/on_machine.rb', line 18 def on_machine(machine, cmd, **) [:sudo] = true unless .has_key?(:sudo) machine.communicate.execute(cmd, ) do |type, data| color = (type == :stdout) ? :green : :red machine.ui.info(data.chomp, :color => color, :prefix => true) end end |