Skip to content

Commit

Permalink
Merge pull request #2 from plesk/cloudlinux-support-small-changes
Browse files Browse the repository at this point in the history
Add an action to avoid problem on plesk internal infrastructure. Update dist-upgrade
  • Loading branch information
SandakovMM authored Jul 16, 2024
2 parents 2b23e64 + 5d0f235 commit 60d6f9a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
34 changes: 34 additions & 0 deletions cloudlinux7to8/actions/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,40 @@ def estimate_post_time(self) -> int:
return 2 * 60


class RemovePleskBaseRepository(action.ActiveAction):
# In some cases we have plesk specific base repository, which will not be
# fixed by the leapp converter. So we have to remove it manually.
base_repo_path: str = "/etc/yum.repos.d/base.repo"

def __init__(self) -> None:
self.name = "removing base repository"

def _is_required(self) -> bool:
return os.path.exists(self.base_repo_path)

def _prepare_action(self) -> action.ActionResult:
return action.ActionResult()

def _is_plesk_base(self, repo_file: str) -> bool:
for id, _2, baseurl, _3, _4, _5 in rpm.extract_repodata(repo_file):
if baseurl and "psabr.aws.plesk.tech/share/mirror/cloudlinux/7" in baseurl:
log.info(f"Plesk base repo found in {repo_file!r} by repository {id!r}")
return True
return False

def _post_action(self) -> action.ActionResult:
if os.path.exists(self.base_repo_path):
if self._is_plesk_base(self.base_repo_path):
files.backup_file(self.base_repo_path)
os.unlink(self.base_repo_path)
return action.ActionResult()

return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
return action.ActionResult()


class AssertPleskRepositoriesNotNoneLink(action.CheckAction):
def __init__(self):
self.name = "checking if plesk repositories does not have a 'none' link"
Expand Down
5 changes: 4 additions & 1 deletion cloudlinux7to8/upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ def construct_actions(
custom_actions.UpdateModernMariadb(),
custom_actions.AddMysqlConnector(),
],
"Do convert": [
"Repositories handling": [
custom_actions.AdoptRepositories(),
],
"Do convert": [
custom_actions.RemovePleskBaseRepository(),
custom_actions.DoCloudLinux7to8Convert(),
],
"Pause before reboot": [
Expand Down

0 comments on commit 60d6f9a

Please sign in to comment.