Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
Clarify "restart"
Browse files Browse the repository at this point in the history
Without this patch, one might be confused by the meaning of
restart, and why we are doing actions twice.

This patch makes it clear that the method used to evaluate
if zypper should run twice is in fact dependent of zypper itself
and it's return code (not on some kind of obscure code output).
It should be easier to follow/review with this kind of wording.
  • Loading branch information
evrardjp committed Jun 15, 2020
1 parent fe87d7e commit f0ac0e8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions skuba-update/skuba_update/skuba_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def update():
Performs an update operation.
"""

code = run_zypper_patch()
if is_restart_needed(code):
code = run_zypper_patch()
return code
returncode = run_zypper_patch()
if zypper_packagemanager_needs_restart(returncode):
returncode = run_zypper_patch()
return returncode


def annotate_node():
Expand Down Expand Up @@ -249,10 +249,10 @@ def is_zypper_error(code):
return code != 0 and code < ZYPPER_EXIT_INF_UPDATE_NEEDED


def is_restart_needed(code):
def zypper_packagemanager_needs_restart(code):
"""
Returns true of the given code is defined by zypper to mean that restart is
needed (zypper itself has been updated).
Returns true if the given return code by zypper means a restart
of zypper is needed (zypper itself has been updated).
"""

return code == ZYPPER_EXIT_INF_RESTART_NEEDED
Expand Down Expand Up @@ -316,8 +316,8 @@ def run_zypper_command(command, needsOutput=False):

def run_zypper_patch():
"""
Run patch updates without --with-optional. --with-optional can cause
conflicts with K8s upgrade scenario.
Install patch updates (zypper patch) without '--with-optional' flag.
--with-optional can cause conflicts with K8s upgrade scenario.
"""
return run_zypper_command([
'--non-interactive', '--non-interactive-include-reboot-patches',
Expand Down

0 comments on commit f0ac0e8

Please sign in to comment.