Skip to content

Commit

Permalink
Merge pull request #404 from plesk/keep-leapp-logs-by-default
Browse files Browse the repository at this point in the history
Keep logs of leapp by default
  • Loading branch information
SandakovMM authored Jan 2, 2025
2 parents a2bbed9 + a39ed8b commit 872a3e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions centos2almaconverter/actions/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

class LeapInstallation(action.ActiveAction):

keep_logs_on_finish: bool
remove_logs_on_finish: bool

def __init__(self, keep_logs_on_finish: bool = False):
def __init__(self, remove_logs_on_finish: bool = True):
self.name = "installing leapp"
self.pkgs_to_install = [
"leapp-0.18.0-1.el7",
Expand All @@ -19,7 +19,7 @@ def __init__(self, keep_logs_on_finish: bool = False):
"leapp-upgrade-el7toel8-0.21.0-2.el7",
"leapp-upgrade-el7toel8-deps-0.21.0-2.el7",
]
self.keep_logs_on_finish = keep_logs_on_finish
self.remove_logs_on_finish = remove_logs_on_finish

def _remove_previous_installation(self) -> None:
# Remove previously installed leapp packages to make sure we will install the correct version
Expand Down Expand Up @@ -75,7 +75,7 @@ def _post_action(self) -> action.ActionResult:
"/var/lib/leapp",
"/usr/lib/python2.7/site-packages/leapp",
]
if not self.keep_logs_on_finish:
if self.remove_logs_on_finish:
leapp_related_directories.append("/var/log/leapp")

for directory in leapp_related_directories:
Expand Down
10 changes: 5 additions & 5 deletions centos2almaconverter/upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self):
self.disable_spamassasin_plugins = False
self.amavis_upgrade_allowed = False
self.allow_raid_devices = False
self.keep_leapp_logs = False
self.remove_leapp_logs = False

def __repr__(self) -> str:
return f"{self.__class__.__name__}(From {self._distro_from}, To {self._distro_to})"
Expand Down Expand Up @@ -122,7 +122,7 @@ def construct_actions(
common_actions.AddInProgressSshLoginMessage(new_os),
],
"Leapp installation": [
centos2alma_actions.LeapInstallation(keep_logs_on_finish=self.keep_leapp_logs),
centos2alma_actions.LeapInstallation(remove_logs_on_finish=self.remove_leapp_logs),
],
"Prepare configurations": [
common_actions.RevertChangesInGrub(),
Expand Down Expand Up @@ -301,8 +301,8 @@ def parse_args(self, args: typing.Sequence[str]) -> None:
help="Allow to upgrade amavis antivirus even if there is not enough RAM available.")
parser.add_argument("--allow-raid-devices", action="store_true", dest="allow_raid_devices", default=False,
help="Allow to have direct RAID devices in /etc/fstab. This could lead to unbootable system after the conversion so use the option on your own risk.")
parser.add_argument("--keep-leapp-logs", action="store_true", dest="keep_leapp_logs", default=False,
help="Keep leapp logs after the conversion. By default, the logs are removed after the conversion.")
parser.add_argument("--remove-leapp-logs", action="store_true", dest="remove_leapp_logs", default=False,
help="Remove leapp logs after the conversion. By default, the logs are removed after the conversion.")
options = parser.parse_args(args)

self.upgrade_postgres_allowed = options.upgrade_postgres_allowed
Expand All @@ -311,7 +311,7 @@ def parse_args(self, args: typing.Sequence[str]) -> None:
self.amavis_upgrade_allowed = options.amavis_upgrade_allowed
self.leapp_ovl_size = options.leapp_ovl_size
self.allow_raid_devices = options.allow_raid_devices
self.keep_leapp_logs = options.keep_leapp_logs
self.remove_leapp_logs = options.remove_leapp_logs


class Centos2AlmaConverterFactory(DistUpgraderFactory):
Expand Down

0 comments on commit 872a3e1

Please sign in to comment.