Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) Improve reboot code #1659

Merged
merged 1 commit into from
Jun 11, 2020
Merged

(maint) Improve reboot code #1659

merged 1 commit into from
Jun 11, 2020

Conversation

sbeaulie
Copy link
Contributor

Before this change, the 'who -b' command was resilient when run before the reboot
Now making it retry too if it cannot find the /boot/ line after a reboot too.
We have seen one instance of a sles-12 machine rebooting, and the first request
for 'who -b' after the reboot failed the connection, which made the search for the line
be nil, and returning a stack trace when trying to convert that into Time with a
TypeError: no implicit conversion of nil into String. Now protects against that
and will retry as expected.

Before this change, the 'who -b' command was resilient when run before the reboot
Now making it retry too if it cannot find the /boot/ line after a reboot too.
We have seen one instance of a sles-12 machine rebooting, and the first request
for 'who -b' after the reboot failed the connection, which made the search for the line
be nil, and returning a stack trace when trying to convert that into Time with a
TypeError: no implicit conversion of nil into String. Now protects against that
and will retry as expected.
@sbeaulie sbeaulie requested a review from a team as a code owner June 11, 2020 16:37
@@ -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)
Copy link
Contributor Author

@sbeaulie sbeaulie Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It should probably be abstracted into a method but this is fine for now.

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It should probably be abstracted into a method but this is fine for now.

@highb highb merged commit 3a8565e into master Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants