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

Support rackspace epel #55

Merged
merged 4 commits into from
Jul 24, 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
6 changes: 5 additions & 1 deletion pleskdistup/actions/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def __init__(self) -> None:
"httpd.service",
"mailman.service",
"mariadb.service",
"mysqld.service",
"named-chroot.service",
"plesk-ext-monitoring-hcd.service",
"plesk-ssh-terminal.service",
Expand All @@ -111,6 +110,11 @@ def __init__(self) -> None:
"plesk-ip-remapping.service",
]

# Once MariaDB has started, systemctl will not be able to control mysqld as a linked unit.
# Therefore, we should manage mysqld separately and only if MariaDB is not present
if "mariadb.service" not in self.plesk_systemd_services and systemd.is_service_startable("mysqld.service"):
self.plesk_systemd_services.append("mysqld.service")

# We don't remove postfix service when remove it during qmail installation
# so we should choose the right smtp service, otherwise they will conflict
if systemd.is_service_startable("qmail.service"):
Expand Down
18 changes: 16 additions & 2 deletions pleskdistup/common/src/leapp_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,24 @@ def _fix_postgresql_official_repository(to_change: str) -> str:
return to_change


def _fix_rackspace_epel_repository(to_change: str) -> str:
# The Rackspace EPEL repository for version 8 has a slightly different path, including 'Everything' in it
# Additionally, some repositories use '7Server' instead of 7.
# Therefore, we need to handle these cases specifically.
if "iad.mirror.rackspace.com/epel/7/" in to_change:
return to_change.replace("7", "8/Everything")
if "iad.mirror.rackspace.com/epel/7Server" in to_change:
return to_change.replace("7Server", "8/Everything")
return to_change


def _do_url_replacement(url: typing.Optional[str]) -> typing.Optional[str]:
return _do_replacement(url, [
_fixup_old_php_urls,
_fix_rackspace_repository,
_fix_mariadb_repository,
_fix_postgresql_official_repository,
_fix_rackspace_epel_repository,
lambda to_change: to_change.replace("rpm-CentOS-7", "rpm-RedHat-el8"),
lambda to_change: to_change.replace("CloudLinux-7", "CloudLinux-8"),
lambda to_change: to_change.replace("cloudlinux/7", "cloudlinux/8"),
Expand Down Expand Up @@ -162,7 +174,7 @@ def is_repo_ok(
return True


def adopt_repositories(repofile: str, ignore: typing.Optional[typing.List[str]] = None) -> None:
def adopt_repositories(repofile: str, ignore: typing.Optional[typing.List[str]] = None, keep_id: bool = False) -> None:
if ignore is None:
ignore = []

Expand All @@ -183,7 +195,9 @@ def adopt_repositories(repofile: str, ignore: typing.Optional[typing.List[str]]

log.debug("Adopt repository with id '{id}' is extracted.".format(id=id))

id = _do_id_replacement(id)
if not keep_id:
id = _do_id_replacement(id)

name = _do_name_replacement(name)
if url is not None:
url = _do_url_replacement(url)
Expand Down
63 changes: 63 additions & 0 deletions pleskdistup/common/tests/leapp_configs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,69 @@ def test_official_postgresql_mapping(self):
self._perform_test({"pgdg-redhat-all.repo": postgresql_like_repos},
expected_postgresql_repos, expected_postgresql_mapping)

def test_rackspace_mapping(self):
mariadb_like_repos = """[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://iad.mirror.rackspace.com/epel/7Server/x86_64/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://iad.mirror.rackspace.com/epel/7Server/x86_64/debug/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://iad.mirror.rackspace.com/epel/7Server/SRPMS/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
"""

expected_mariadb_repos = """[alma-epel]
name=Alma Extra Packages for Enterprise Linux 8 - $basearch
baseurl=http://iad.mirror.rackspace.com/epel/8/Everything/x86_64/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[alma-epel-debuginfo]
name=Alma Extra Packages for Enterprise Linux 8 - $basearch - Debug
baseurl=http://iad.mirror.rackspace.com/epel/8/Everything/x86_64/debug/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
[alma-epel-source]
name=Alma Extra Packages for Enterprise Linux 8 - $basearch - Source
baseurl=http://iad.mirror.rackspace.com/epel/8/Everything/SRPMS/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
"""

expected_mariadb_mapping = """epel,alma-epel,alma-epel,all,all,x86_64,rpm,ga,ga
epel-debuginfo,alma-epel-debuginfo,alma-epel-debuginfo,all,all,x86_64,rpm,ga,ga
epel-source,alma-epel-source,alma-epel-source,all,all,x86_64,rpm,ga,ga
"""

self._perform_test({"mariadb.repo": mariadb_like_repos},
expected_mariadb_repos, expected_mariadb_mapping)


class SetPackageRepositoryTests(unittest.TestCase):
INITIAL_JSON = {
Expand Down
Loading