|
| 1 | +from leapp import reporting |
| 2 | +from leapp.libraries.common.rpms import has_package |
| 3 | +from leapp.libraries.stdlib import api |
| 4 | +from leapp.models import DistributionSignedRPM |
| 5 | + |
| 6 | +# Summary for mysql-server report |
| 7 | +# TODO: Fix versions |
| 8 | +report_server_inst_summary = ( |
| 9 | + 'MySQL server component will be reinstalled during upgrade with RHEL 9 version. ' |
| 10 | + 'Since RHEL 9 includes the same version by default, no action should be ' |
| 11 | + 'needed and there shouldn\'t be any compatibility issues. It is still advisable ' |
| 12 | + 'to follow documentation/article on this topic for up to date recommendations. ' |
| 13 | + 'Keep in mind that MySQL version 8.0, which is present as a default in RHEL 9, ' |
| 14 | + 'will go out of the \'Extended Support\' in April 2026. MySQL 8.4 will be ' |
| 15 | + 'provided in RHEL 9 via module, and it is advisable to upgrade to that version. ' |
| 16 | + 'MySQL 8.4 is also the default version for RHEL 10, so having the MySQL 8.4 ' |
| 17 | + 'on RHEL 9 system will make the process of upgrading to RHEL 10 even smoother.' |
| 18 | +) |
| 19 | + |
| 20 | +report_server_inst_hint = ( |
| 21 | + 'Dump or backup your data before proceeding with the upgrade ' |
| 22 | + 'and consult attached article ' |
| 23 | + '\'Migrating MySQL databases from RHEL 8 to RHEL 9\' ' |
| 24 | + 'with up to date recommended steps before and after the upgrade.' |
| 25 | +) |
| 26 | + |
| 27 | +# TODO: Replace with mysql-report |
| 28 | +# Link URL for mysql-server report |
| 29 | +report_server_inst_link_url = 'https://access.redhat.com/articles/7099753' |
| 30 | + |
| 31 | + |
| 32 | +def _report_server_installed(): |
| 33 | + """ |
| 34 | + Create report on mysql-server package installation detection. |
| 35 | +
|
| 36 | + Should remind user about present MySQL server package |
| 37 | + installation, warn them about necessary additional steps, and |
| 38 | + redirect them to online documentation for the upgrade process. |
| 39 | + """ |
| 40 | + reporting.create_report([ |
| 41 | + reporting.Title('Further action to upgrade MySQL might be needed'), |
| 42 | + reporting.Summary(report_server_inst_summary), |
| 43 | + reporting.Severity(reporting.Severity.MEDIUM), |
| 44 | + reporting.Groups([reporting.Groups.SERVICES]), |
| 45 | + reporting.ExternalLink(title='Migrating MySQL databases from RHEL 8 to RHEL 9', |
| 46 | + url=report_server_inst_link_url), |
| 47 | + reporting.RelatedResource('package', 'mysql-server'), |
| 48 | + reporting.Remediation(hint=report_server_inst_hint), |
| 49 | + ]) |
| 50 | + |
| 51 | + |
| 52 | +def report_installed_packages(_context=api): |
| 53 | + """ |
| 54 | + Create reports according to detected MySQL packages. |
| 55 | +
|
| 56 | + Create the report if the mysql-server rpm (RH signed) is installed. |
| 57 | + """ |
| 58 | + has_server = has_package(DistributionSignedRPM, 'mysql-server', context=_context) |
| 59 | + |
| 60 | + if has_server: |
| 61 | + _report_server_installed() |
0 commit comments