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

Update upgrade ready message shown to customer #11

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ repos:
]
- id: sync-scripts-to-yaml
name: sync-scripts-to-yaml
entry: python misc/sync_scripts_to_yaml.py
entry: python misc/sync_scripts.py
additional_dependencies: [ruamel.yaml==0.16.13]
args: ["--target", "repo"]
language: python
types: [python]
pass_filenames: false
files: scripts/.*\.py$


Expand Down
14 changes: 9 additions & 5 deletions playbooks/leapp_preupgrade_script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@

def setup_leapp(version):
leapp_install_command, rhel_rhui_packages = _get_leapp_command_and_packages(version)
if _check_if_package_installed('leapp-upgrade'):
if _check_if_package_installed("leapp-upgrade"):
print("'leapp-upgrade' already installed, skipping ...")
else:
print("Installing leapp ...")
Expand Down Expand Up @@ -352,7 +352,11 @@
)
)
if reboot_required:
message += " System is ready to be upgraded. Rebooting system in 1 minute."
problem_info = message.lstrip("Your system has ").rstrip(".")
message = (
"System will be upgraded (%s). Rebooting system in 1 minute."
% problem_info
)
alert = inhibitor_count > 0 or error_count > 0
status = (
_find_highest_report_level(report_entries)
Expand Down Expand Up @@ -425,11 +429,11 @@

remove_previous_reports()
leapp_output = execute_operation(operation_command)
reboot_required = REBOOT_GUIDANCE_MESSAGE in leapp_output
parse_results(output, reboot_required)
upgrade_reboot_required = REBOOT_GUIDANCE_MESSAGE in leapp_output
parse_results(output, upgrade_reboot_required)
update_insights_inventory(output)
print("Operation {} finished successfully.".format(SCRIPT_TYPE.title()))
if reboot_required:
if upgrade_reboot_required:
reboot_system()
except ProcessError as exception:
print(exception.report)
Expand Down
14 changes: 9 additions & 5 deletions playbooks/leapp_upgrade_script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@

def setup_leapp(version):
leapp_install_command, rhel_rhui_packages = _get_leapp_command_and_packages(version)
if _check_if_package_installed('leapp-upgrade'):
if _check_if_package_installed("leapp-upgrade"):
print("'leapp-upgrade' already installed, skipping ...")
else:
print("Installing leapp ...")
Expand Down Expand Up @@ -352,7 +352,11 @@
)
)
if reboot_required:
message += " System is ready to be upgraded. Rebooting system in 1 minute."
problem_info = message.lstrip("Your system has ").rstrip(".")
message = (
"System will be upgraded (%s). Rebooting system in 1 minute."
% problem_info
)
alert = inhibitor_count > 0 or error_count > 0
status = (
_find_highest_report_level(report_entries)
Expand Down Expand Up @@ -425,11 +429,11 @@

remove_previous_reports()
leapp_output = execute_operation(operation_command)
reboot_required = REBOOT_GUIDANCE_MESSAGE in leapp_output
parse_results(output, reboot_required)
upgrade_reboot_required = REBOOT_GUIDANCE_MESSAGE in leapp_output
parse_results(output, upgrade_reboot_required)
update_insights_inventory(output)
print("Operation {} finished successfully.".format(SCRIPT_TYPE.title()))
if reboot_required:
if upgrade_reboot_required:
reboot_system()
except ProcessError as exception:
print(exception.report)
Expand Down
14 changes: 9 additions & 5 deletions scripts/leapp_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _get_leapp_command_and_packages(version):

def setup_leapp(version):
leapp_install_command, rhel_rhui_packages = _get_leapp_command_and_packages(version)
if _check_if_package_installed('leapp-upgrade'):
if _check_if_package_installed("leapp-upgrade"):
print("'leapp-upgrade' already installed, skipping ...")
else:
print("Installing leapp ...")
Expand Down Expand Up @@ -345,7 +345,11 @@ def parse_results(output, reboot_required=False):
)
)
if reboot_required:
message += " System is ready to be upgraded. Rebooting system in 1 minute."
problem_info = message.lstrip("Your system has ").rstrip(".")
message = (
"System will be upgraded (%s). Rebooting system in 1 minute."
% problem_info
)
alert = inhibitor_count > 0 or error_count > 0
status = (
_find_highest_report_level(report_entries)
Expand Down Expand Up @@ -418,11 +422,11 @@ def main():

remove_previous_reports()
leapp_output = execute_operation(operation_command)
reboot_required = REBOOT_GUIDANCE_MESSAGE in leapp_output
parse_results(output, reboot_required)
upgrade_reboot_required = REBOOT_GUIDANCE_MESSAGE in leapp_output
parse_results(output, upgrade_reboot_required)
update_insights_inventory(output)
print("Operation {} finished successfully.".format(SCRIPT_TYPE.title()))
if reboot_required:
if upgrade_reboot_required:
reboot_system()
except ProcessError as exception:
print(exception.report)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parse_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_gather_report_files_exist_with_reboot(mock_find_level, mock_exists):
assert output.report_json.get("test") == "hi"
assert (
output.message
== "Your system has 0 errors and 0 inhibitors out of 0 potential problems. System is ready to be upgraded. Rebooting system in 1 minute."
== "System will be upgraded (0 errors and 0 inhibitors out of 0 potential problems). Rebooting system in 1 minute."
)


Expand Down
Loading