Skip to content

Commit

Permalink
Merge pull request #216 from plesk/support-atomic
Browse files Browse the repository at this point in the history
Add action for mapping atomic repositories
  • Loading branch information
SandakovMM authored Mar 22, 2024
2 parents f9e517a + 76e22b2 commit cae72cf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
4 changes: 2 additions & 2 deletions actions/mariadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _do_check(self) -> bool:

for repofile in repofiles:
for repo in rpm.extract_repodata(repofile):
repo_id, _, repo_baseurl, _, _ = repo
repo_id, _, repo_baseurl, _, _, _ = repo
if ".mariadb.org" not in repo_baseurl:
continue

Expand Down Expand Up @@ -68,7 +68,7 @@ def _post_action(self) -> None:
for repofile in repofiles:
leapp_configs.adopt_repositories(repofile)

mariadb_repo_id, _1, _2, _3, _4 = [repo for repo in rpm.extract_repodata(repofiles[0])][0]
mariadb_repo_id, _1, _2, _3, _4, _5 = [repo for repo in rpm.extract_repodata(repofiles[0])][0]

rpm.remove_packages(rpm.filter_installed_packages(["MariaDB-client",
"MariaDB-client-compat",
Expand Down
30 changes: 25 additions & 5 deletions actions/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ def _use_rpmnew_repositories(self):
def _adopt_plesk_repositories(self):
for file in files.find_files_case_insensitive("/etc/yum.repos.d", ["plesk*.repo"]):
rpm.remove_repositories(file, [
lambda id, _1, _2, _3: id in ["PLESK_17_PHP52", "PLESK_17_PHP53",
"PLESK_17_PHP54", "PLESK_17_PHP55",
"PLESK_17_PHP56", "PLESK_17_PHP70"],
lambda id, _1, _2, _3, _4: id in ["PLESK_17_PHP52", "PLESK_17_PHP53",
"PLESK_17_PHP54", "PLESK_17_PHP55",
"PLESK_17_PHP56", "PLESK_17_PHP70"],
])
leapp_configs.adopt_repositories(file)

Expand All @@ -232,7 +232,7 @@ def __init__(self):

def _is_required(self):
for file in files.find_files_case_insensitive("/etc/yum.repos.d", ["plesk*migrator*.repo"]):
for _1, _2, url, _3, _4 in rpm.extract_repodata(file):
for _1, _2, url, _3, _4, _5 in rpm.extract_repodata(file):
if "PMM_0.1.10/thirdparty-rpm" in url:
return True

Expand All @@ -243,7 +243,7 @@ def _prepare_action(self):
files.backup_file(file)

rpm.remove_repositories(file, [
lambda _1, _2, baseurl, _3: "PMM_0.1.10/thirdparty-rpm" in baseurl,
lambda _1, _2, baseurl, _3, _4: "PMM_0.1.10/thirdparty-rpm" in baseurl,
])

def _post_action(self):
Expand Down Expand Up @@ -296,3 +296,23 @@ def _do_check(self):
self.description = self.description.format(repo_paths=path)
return False
return True


class AdoptAtomicRepositories(action.ActiveAction):
atomic_repository_path: str = "/etc/yum.repos.d/tortix-common.repo"

def __init__(self):
self.name = "adopting atomic repositories"

def is_required(self):
return os.path.exists(self.atomic_repository_path)

def _prepare_action(self):
leapp_configs.add_repositories_mapping([self.atomic_repository_path])

def _post_action(self):
# We don't need to adopt repositories here because repositories uses $releasever-$basearch
pass

def _revert_action(self):
pass
2 changes: 1 addition & 1 deletion common
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def construct_actions(options: typing.Any, stage_flag: Stages) -> typing.Dict[in
actions.LeapReposConfiguration(),
actions.LeapChoicesConfiguration(),
actions.AdoptKolabRepositories(),
actions.AdoptAtomicRepositories(),
actions.FixupImunify(),
actions.PatchLeappErrorOutput(),
actions.PatchLeappDebugNonAsciiPackager(),
Expand Down

0 comments on commit cae72cf

Please sign in to comment.