Skip to content

Commit 8cca81d

Browse files
authored
Add blocker for outdated mariadb versions
1 parent 22087da commit 8cca81d

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
OLD_CLMYSQL_VERSIONS = ["5.0", "5.1"]
3232
OLD_MYSQL_UPSTREAM_VERSIONS_CL7 = ["5.7", "5.6", "5.5"]
3333
OLD_MYSQL_UPSTREAM_VERSIONS_CL8 = ["5.7", "5.6"] # adjust as needed for CL8
34+
OLD_MARIADB_UPSTREAM_VERSIONS_CL8 = ["10.3", "10.4"] # MariaDB versions to block for CL8 source
3435

3536

3637
def build_install_list(prefix):
@@ -194,8 +195,13 @@ def _make_upgrade_mariadb_url(self, mariadb_url, source_major, target_major):
194195
# Replace the first occurrence of source_major with target_major after 'yum'
195196
url_parts = mariadb_url.split("yum", 1)
196197
if len(url_parts) == 2:
197-
# Replace only the first digit (source_major) after 'yum'
198-
url_parts[1] = url_parts[1].replace(str(source_major), str(target_major), 1)
198+
# Replace major version in "/centos/7/" and /yum/12.0/almalinux9-amd64/,
199+
# but do not replace it in /mariadb-10.7/yum/
200+
url_parts[1] = url_parts[1].replace("/{}/".format(source_major), "/{}/".format(target_major))
201+
url_parts[1] = url_parts[1].replace("{}-".format(source_major), "{}-".format(target_major))
202+
# Replace $releasever because upstream repos expect major version
203+
# and cloudlinux provides major.minor as $releasever
204+
url_parts[1] = url_parts[1].replace('$releasever', str(target_major))
199205
return "yum".join(url_parts)
200206
else:
201207
# TODO: fix in https://cloudlinux.atlassian.net/browse/CLOS-3490
@@ -218,6 +224,31 @@ def mariadb_process(self, repofile_name, repofile_data):
218224
target_repo.baseurl = self._make_upgrade_mariadb_url(source_repo.baseurl, source_major, target_major)
219225

220226
if target_repo.enabled:
227+
# MariaDB 10.4 is not compatible with Leapp upgrade
228+
if str(source_major) == "8" and any(ver in target_repo.baseurl for ver in OLD_MARIADB_UPSTREAM_VERSIONS_CL8):
229+
reporting.create_report(
230+
[
231+
reporting.Title("MariaDB is not compatible with Leapp upgrade"),
232+
reporting.Summary(
233+
"MariaDB is enabled on this system but is not compatible with Leapp upgrade process. "
234+
"The upgrade is blocked to prevent system instability. "
235+
"This situation cannot be automatically resolved by Leapp. "
236+
"Problematic repository: {0}".format(target_repo.repoid)
237+
),
238+
reporting.Severity(reporting.Severity.MEDIUM),
239+
reporting.Groups([reporting.Groups.REPOSITORY]),
240+
reporting.Groups([reporting.Groups.INHIBITOR]),
241+
reporting.Remediation(
242+
hint=(
243+
"Upgrade to a more recent MariaDB version, or "
244+
"uninstall the MariaDB packages and disable the repository. "
245+
"Note that you will also need to update any bindings (e.g., PHP or Python) "
246+
"that are dependent on this MariaDB version."
247+
)
248+
),
249+
]
250+
)
251+
221252
api.current_logger().debug("Generating custom MariaDB repo: {}".format(target_repo.repoid))
222253
self.custom_repo_msgs.append(
223254
CustomTargetRepository(

0 commit comments

Comments
 (0)