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

[crmsh-4.6] Fix: upgradeutil: refine error handling (bsc#1226147, bsc#1223371) #1457

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions crmsh/upgradeutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,24 @@
except (prun.PRunError, user_of_host.UserNotFoundError) as e:
logger.debug("upgradeutil: get-seq failed: %s", e)
raise _SkipUpgrade() from None
try:
return all(
CURRENT_UPGRADE_SEQ == _parse_upgrade_seq(result.stdout.strip()) if result.returncode == 0 else False
for result in results.values()
)
except ValueError as e:
logger.warning("Remote command '%s' returns unexpected output: %s", cmd, results, exc_info=e)
return False
ret = True
for node, result in results.items():
if result.returncode != 0:
logger.debug(

Check warning on line 109 in crmsh/upgradeutil.py

View check run for this annotation

Codecov / codecov/patch

crmsh/upgradeutil.py#L109

Added line #L109 was not covered by tests
"upgradeutil: remote command '%s' fails on %s: rc=%s, stdout=%s, stderr=%s",
cmd, node, result.returncode, result.stdout, result.stderr,
)
raise _SkipUpgrade() from None

Check warning on line 113 in crmsh/upgradeutil.py

View check run for this annotation

Codecov / codecov/patch

crmsh/upgradeutil.py#L113

Added line #L113 was not covered by tests
else:
try:
seq = _parse_upgrade_seq(result.stdout.strip())
if CURRENT_UPGRADE_SEQ != seq:
ret = False
logger.debug('seq %s from %s != %s', seq, node, CURRENT_UPGRADE_SEQ)
except ValueError as e:
ret = False
logger.warning("upgradeutil: remote command '%s' returns unexpected output: %s", cmd, results, exc_info=e)

Check warning on line 122 in crmsh/upgradeutil.py

View check run for this annotation

Codecov / codecov/patch

crmsh/upgradeutil.py#L118-L122

Added lines #L118 - L122 were not covered by tests
return ret


def _get_minimal_seq_in_cluster(nodes) -> typing.Tuple[int, int]:
Expand Down
Loading