Skip to content

Commit

Permalink
Merge pull request #26 from plesk/hightlight-revert-option
Browse files Browse the repository at this point in the history
Highlight that the --revert option can be utilized in the event of a conversion failure
  • Loading branch information
SandakovMM authored Apr 12, 2024
2 parents efc9aee + 0a14058 commit c74b388
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions pleskdistup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def handle_error(
logfile_path: PathType,
util_name: str,
status_flag_path: PathType,
phase: Phase,
upgrader: DistUpgrader,
) -> None:
print()
Expand All @@ -134,7 +135,13 @@ def handle_error(
print(line, end='')
error_message += line

print(messages.FAIL_MESSAGE_TAIL.format(util_name=util_name, logfile_path=logfile_path), end='')
# When adding something to the additional_message, remember to include '\n' at the beginning.
# This is because the FAIL_MESSAGE_TAIL contains the additional_message at the end of the previous line,
# preventing an empty line if there is nothing inside the additional_message.
additional_message = ""
if phase is Phase.CONVERT:
additional_message = f"\nTo revert the server to its original state, call '{util_name} --revert'."
print(messages.FAIL_MESSAGE_TAIL.format(util_name=util_name, logfile_path=logfile_path, additional_message=additional_message), end='')

plesk.send_error_report(error_message)
plesk.send_conversion_status(False, str(status_flag_path))
Expand Down Expand Up @@ -240,7 +247,7 @@ def do_convert(
print(messages.FINISH_RESTART_MESSAGE, end='')
systemd.do_reboot()
except Exception as e:
handle_error(str(e), logfile_path, util_name, options.status_flag_path, upgrader)
handle_error(str(e), logfile_path, util_name, options.status_flag_path, options.phase, upgrader)
return 1
else:
for stage_id, actions in actions_map.items():
Expand Down
2 changes: 1 addition & 1 deletion pleskdistup/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
\033[91m**************************************************************************************
The dist-ugrade process has failed. See the {logfile_path} file for more information.
The last 100 lines of the file are shown above.
For assistance, call '{util_name} --prepare-feedback' and follow the instructions.
For assistance, call '{util_name} --prepare-feedback' and follow the instructions.{additional_message}
**************************************************************************************\033[0m
"""

Expand Down

0 comments on commit c74b388

Please sign in to comment.