|
| 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 libdb report |
| 7 | +report_libdb_inst_summary = ( |
| 8 | + 'Libdb was marked as deprecated in RHEL-9 and in RHEL-10 is not included anymore.' |
| 9 | + ' There are a couple of alternatives in RHEL-10; the applications that' |
| 10 | + ' depend on libdb will not work. Such applications must implement another' |
| 11 | + ' type of backend storage. And migrate existing data to the new database' |
| 12 | + ' format; for the conversion, the tool db_converter from the libdb-utils' |
| 13 | + ' rpm could be used.' |
| 14 | + |
| 15 | +report_libdb_inst_hint = ( |
| 16 | + 'Back up your data before proceeding with the data upgrade/migration.' |
| 17 | +) |
| 18 | + |
| 19 | +# Link URL for libdb report |
| 20 | +report_libdb_inst_link_url = 'https://access.redhat.com/articles/7099256' |
| 21 | + |
| 22 | + |
| 23 | +def _report_libdb_installed(): |
| 24 | + """ |
| 25 | + Create report on libdb package installation detection. |
| 26 | +
|
| 27 | + Should remind user about present libdb package |
| 28 | + installation, warn them about the lack of libdb support in RHEL 10, and |
| 29 | + redirect them to online documentation for the migration process. |
| 30 | + """ |
| 31 | + reporting.create_report([ |
| 32 | + reporting.Title('Berkeley DB (libdb) has been detected on your system'), |
| 33 | + reporting.Summary(report_libdb_inst_summary), |
| 34 | + reporting.Severity(reporting.Severity.MEDIUM), |
| 35 | + reporting.Groups([reporting.Groups.SERVICES]), |
| 36 | + reporting.ExternalLink(title='Migrating to a RHEL 10 without libdb', |
| 37 | + url=report_libdb_inst_link_url), |
| 38 | + reporting.RelatedResource('package', 'libdb'), |
| 39 | + reporting.Remediation(hint=report_libdb_inst_hint), |
| 40 | + ]) |
| 41 | + |
| 42 | + |
| 43 | +def report_installed_packages(_context=api): |
| 44 | + """ |
| 45 | + Create reports according to detected libdb packages. |
| 46 | +
|
| 47 | + Create the report if the libdb rpm (RH signed) is installed. |
| 48 | + """ |
| 49 | + has_libdb = has_package(DistributionSignedRPM, 'libdb', context=_context) |
| 50 | + |
| 51 | + if has_libdb: |
| 52 | + _report_libdb_installed() |
0 commit comments