Skip to content

Commit

Permalink
Merge pull request #1659 from puppetlabs/maint-improve-reboot
Browse files Browse the repository at this point in the history
(maint) Improve reboot code
  • Loading branch information
highb authored Jun 11, 2020
2 parents d72a479 + b097888 commit 3a8565e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/beaker/host/unix/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def reboot(wait_time=10, max_connection_tries=9, uptime_retries=18)
sleep wait_time

current_boot_time_str = exec(Beaker::Command.new('who -b'), {:max_connection_tries => max_connection_tries, :silent => true}).stdout
current_boot_time = Time.parse(current_boot_time_str.lines.grep(/boot/).first)
current_boot_time_line = current_boot_time_str.lines.grep(/boot/).first

raise Beaker::Host::RebootFailure, "Could not find system boot time using 'who -b': '#{current_boot_time_str}'" unless current_boot_time_line

current_boot_time = Time.parse(current_boot_time_line)

@logger.debug("Original Boot Time: #{original_boot_time}")
@logger.debug("Current Boot Time: #{current_boot_time}")
Expand Down

0 comments on commit 3a8565e

Please sign in to comment.