Skip to content

Commit 5bfb2a4

Browse files
committed
Enhance ClMysqlRepositorySetup actor lib to handle unsupported MariaDB repository URLs
Added logging for cases where the MariaDB URL is invalid or no version replacement occurs because of unrecognized pattern.
1 parent 3e4196c commit 5bfb2a4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def _make_upgrade_mariadb_url(mariadb_url, source_major, target_major):
3232
We replace the parts of the URL to make them work with the target OS version.
3333
"""
3434
if not mariadb_url:
35+
api.current_logger().warning("Unsupported repository URL={}, skipping".format(mariadb_url))
3536
return None
3637
# Replace the first occurrence of source_major with target_major after 'yum'
3738
url_parts = mariadb_url.split("yum", 1)
@@ -43,10 +44,15 @@ def _make_upgrade_mariadb_url(mariadb_url, source_major, target_major):
4344
# Replace $releasever because upstream repos expect major version
4445
# and cloudlinux provides major.minor as $releasever
4546
url_parts[1] = url_parts[1].replace('$releasever', str(target_major))
46-
return "yum".join(url_parts)
47+
new_url = "yum".join(url_parts)
48+
# Treat as unsupported if no version replacement was made (e.g. "example.com/mariadb/yum")
49+
if new_url == mariadb_url and "/{}/".format(target_major) not in new_url:
50+
api.current_logger().warning("Unsupported repository URL={}, skipping".format(mariadb_url))
51+
return None
52+
return new_url
4753
else:
4854
api.current_logger().warning("Unsupported repository URL={}, skipping".format(mariadb_url))
49-
return
55+
return None
5056

5157

5258
def mariadb_process(lib, repofile_name, repofile_data):

0 commit comments

Comments
 (0)