lib/beaker/dsl/helpers/host_helpers.rb in beaker-2.10.0 vs lib/beaker/dsl/helpers/host_helpers.rb in beaker-2.11.0
- old
+ new
@@ -3,17 +3,26 @@
module Helpers
# Methods that help you interact and manage the state of your Beaker SUTs, these
# methods do not require puppet to be installed to execute correctly
module HostHelpers
- # @!macro common_opts
+ # @!macro [new] common_opts
# @param [Hash{Symbol=>String}] opts Options to alter execution.
# @option opts [Boolean] :silent (false) Do not produce log output
# @option opts [Array<Fixnum>] :acceptable_exit_codes ([0]) An array
# (or range) of integer exit codes that should be considered
# acceptable. An error will be thrown if the exit code does not
# match one of the values in this list.
+ # @option opts [Boolean] :accept_all_exit_codes (false) Consider all
+ # exit codes as passing.
+ # @option opts [Boolean] :dry_run (false) Do not actually execute any
+ # commands on the SUT
+ # @option opts [String] :stdin (nil) Input to be provided during command
+ # execution on the SUT.
+ # @option opts [Boolean] :pty (false) Execute this command in a pseudoterminal.
+ # @option opts [Boolean] :expect_connection_failure (false) Expect this command
+ # to result in a connection failure, reconnect and continue execution.
# @option opts [Hash{String=>String}] :environment ({}) These will be
# treated as extra environment variables that should be set before
# running the command.
#
@@ -412,14 +421,14 @@
log_prefix = host.log_prefix
logger.debug "\n#{log_prefix} #{Time.new.strftime('%H:%M:%S')}$ #{command}"
logger.debug " Trying command #{max_retries} times."
logger.debug ".", add_newline=false
- result = on host, command, {:acceptable_exit_codes => (0...127), :silent => !verbose}, &block
+ result = on host, command, {:accept_all_exit_codes => true, :silent => !verbose}, &block
num_retries = 0
until desired_exit_codes.include?(result.exit_code)
sleep retry_interval
- result = on host, command, {:acceptable_exit_codes => (0...127), :silent => !verbose}, &block
+ result = on host, command, {:accept_all_exit_codes => true, :silent => !verbose}, &block
num_retries += 1
logger.debug ".", add_newline=false
if (num_retries > max_retries)
logger.debug " Command \`#{command}\` failed."
fail("Command \`#{command}\` failed.")