Skip to content

Commit e63a302

Browse files
authored
[crmsh-4.5] Fix: upgradeutil: refine error handling (bsc#1226147, bsc#1223371) (#1453)
Getting upgrade seq from remote node may fails for various reasons. Previous code handles SSH problems gracefully but other problems are note handled and turn into misleading error messages. This commit handles those problems in the same way in which SSH problems are handled: output detail information to debug log and skip upgrading.
2 parents c7ae0a3 + 028f492 commit e63a302

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

crmsh/upgradeutil.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,24 @@ def _is_cluster_target_seq_consistent(nodes):
102102
except (prun.PRunError, crmsh.utils.UserOfHost.UserNotFoundError) as e:
103103
logger.debug("upgradeutil: get-seq failed: %s", e)
104104
raise _SkipUpgrade() from None
105-
try:
106-
return all(
107-
CURRENT_UPGRADE_SEQ == _parse_upgrade_seq(result.stdout.strip()) if result.returncode == 0 else False
108-
for result in results.values()
109-
)
110-
except ValueError as e:
111-
logger.warning("Remote command '%s' returns unexpected output: %s", cmd, results, exc_info=e)
112-
return False
105+
ret = True
106+
for node, result in results.items():
107+
if result.returncode != 0:
108+
logger.debug(
109+
"upgradeutil: remote command '%s' fails on %s: rc=%s, stdout=%s, stderr=%s",
110+
cmd, node, result.returncode, result.stdout, result.stderr,
111+
)
112+
raise _SkipUpgrade() from None
113+
else:
114+
try:
115+
seq = _parse_upgrade_seq(result.stdout.strip())
116+
if CURRENT_UPGRADE_SEQ != seq:
117+
ret = False
118+
logger.debug('seq %s from %s != %s', seq, node, CURRENT_UPGRADE_SEQ)
119+
except ValueError as e:
120+
ret = False
121+
logger.warning("upgradeutil: remote command '%s' returns unexpected output: %s", cmd, results, exc_info=e)
122+
return ret
113123

114124

115125
def _get_minimal_seq_in_cluster(nodes) -> typing.Tuple[int, int]:

0 commit comments

Comments
 (0)