Sha256: 696a0e621b9dc337b564988f2b3cc9157713bc650bf2186a043898662e748ea2

Contents?: true

Size: 754 Bytes

Versions: 6

Compression:

Stored size: 754 Bytes

Contents

# frozen_string_literal: true

require_relative '../runner'

# Case class -> DSL module:
# * goto
# * run
module DSL
  # Run command from the host identify as pHostname
  # goto :host1, :execute => "command"
  def goto(host = :localhost, args = {})
    @result.reset
    @action[:command] = args[:execute] if args[:execute]
    @action[:command] = args[:exec] if args[:exec]
    tempfile(args[:tempfile]) if args[:tempfile]
    @action[:encoding] = args[:encoding] || 'UTF-8'

    start_time = Time.now
    run_cmd_on(host)
    @action[:duration] = (Time.now - start_time).round(3)
  end
  alias on goto

  ##
  # DLS run: It's the same as goto :localhost
  def run(command, args = {})
    args[:exec] = command.to_s
    goto(:localhost, args)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
teuton-2.1.8 lib/teuton/case_manager/case/dsl/goto.rb
teuton-2.1.8dev1 lib/teuton/case_manager/case/dsl/goto.rb
teuton-2.1.7 lib/teuton/case_manager/case/dsl/goto.rb
teuton-2.1.6 lib/teuton/case_manager/case/dsl/goto.rb
teuton-2.1.5dev lib/teuton/case_manager/case/dsl/goto.rb
teuton-2.1.4 lib/teuton/case_manager/case/dsl/goto.rb