Method: Beaker::DSL::Helpers::HostHelpers#echo_on

Defined in:
lib/beaker/dsl/helpers/host_helpers.rb

#echo_on(hosts, val) ⇒ String, Array<String> The echo'ed value(s) returned by the host(s)

‘echo’ the provided value on the given host(s)

Parameters:

  • hosts (Host, Array<Host>, String, Symbol)

    One or more hosts to act upon, or a role (String or Symbol) that identifies one or more hosts.

  • val (String)

    The string to ‘echo’ on the host(s)

Returns:

  • (String, Array<String> The echo'ed value(s) returned by the host(s))

    String, Array<String> The echo’ed value(s) returned by the host(s)



576
577
578
579
580
581
582
583
584
# File 'lib/beaker/dsl/helpers/host_helpers.rb', line 576

def echo_on hosts, val
  block_on hosts do |host|
    if host.is_powershell?
      host.exec(Command.new("echo #{val}")).stdout.chomp
    else
      host.exec(Command.new("echo \"#{val}\"")).stdout.chomp
    end
  end
end