Skip to content

Commit

Permalink
Introduce an action to create a leapp mapping and abopt it on finishi…
Browse files Browse the repository at this point in the history
…ng stage
  • Loading branch information
Mikhail Sandakov committed Oct 8, 2024
1 parent cc54697 commit 6f9914f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions centos2almaconverter/actions/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,29 @@ def _do_check(self) -> bool:
return False
return True


class HandleInternetxRepository(action.ActiveAction):
KNOWN_INTERNETX_REPO_FILES = ["internetx.repo"]

def __init__(self):
self.name = "handling InternetX repository"

def is_required(self) -> bool:
return len(files.find_files_case_insensitive("/etc/yum.repos.d", self.KNOWN_INTERNETX_REPO_FILES)) > 0

def _prepare_action(self) -> action.ActionResult:
for file in files.find_files_case_insensitive("/etc/yum.repos.d", self.KNOWN_INTERNETX_REPO_FILES):
files.backup_file(file)
leapp_configs.add_repositories_mapping([file])
return action.ActionResult()

def _post_action(self) -> action.ActionResult:
for file in files.find_files_case_insensitive("/etc/yum.repos.d", self.KNOWN_INTERNETX_REPO_FILES):
files.remove_backup(file)
leapp_configs.adopt_repositories(file)
return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
for file in files.find_files_case_insensitive("/etc/yum.repos.d", self.KNOWN_INTERNETX_REPO_FILES):
files.restore_file_from_backup(file)
return action.ActionResult()
1 change: 1 addition & 0 deletions centos2almaconverter/upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def construct_actions(
common_actions.DisableSelinuxDuringUpgrade(),
centos2alma_actions.RestoreMissingNginx(),
common_actions.ReinstallAmavisAntivirus(),
centos2alma_actions.HandleInternetxRepository(),
],
"First plesk start": [
common_actions.StartPleskBasicServices(),
Expand Down

0 comments on commit 6f9914f

Please sign in to comment.