From 87c19d2550d8037f3127479714f83a8a5505e2ca Mon Sep 17 00:00:00 2001 From: Inessa Vasilevskaya Date: Fri, 22 Dec 2023 14:08:14 +0100 Subject: [PATCH] Address pstodulk's review comments Introduce LeappComponents enum --- repos/system_upgrade/common/libraries/rpms.py | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/repos/system_upgrade/common/libraries/rpms.py b/repos/system_upgrade/common/libraries/rpms.py index 8c6aa4c179..d7251942d2 100644 --- a/repos/system_upgrade/common/libraries/rpms.py +++ b/repos/system_upgrade/common/libraries/rpms.py @@ -2,25 +2,35 @@ from leapp.libraries.common.config.version import get_source_major_version from leapp.models import InstalledRPM + +class LeappComponents(object): + FRAMEWORK = 'framework' + REPOSITORY = 'repository' + COCKPIT = 'cockpit' + TOOLS = 'tools' + + LEAPP_PACKAGES_MAP = { - 'framework': {'7': {'pkgs': ['leapp', 'python2-leapp'], - 'deps': ['leapp-deps']}, - '8': {'pkgs': ['leapp', 'python3-leapp'], - 'deps': ['leapp-deps']} - }, - 'repository': {'7': {'pkgs': ['leapp-upgrade-el7toel8'], - 'deps': ['leapp-upgrade-el7toel8-deps']}, - '8': {'pkgs': ['leapp-upgrade-el8toel9'], - 'deps': ['leapp-upgrade-el8toel9-deps']} - }, - 'cockpit': {'7': {'pkgs': ['cockpit-leapp']}, - '8': {'pkgs': ['cockpit-leapp']} - }, - 'tools': {'7': {'pkgs': ['snactor']}, - '8': {'pkgs': ['snactor']} - } + LeappComponents.FRAMEWORK: {'7': {'pkgs': ['leapp', 'python2-leapp'], + 'deps': ['leapp-deps']}, + '8': {'pkgs': ['leapp', 'python3-leapp'], + 'deps': ['leapp-deps']} + }, + LeappComponents.REPOSITORY: {'7': {'pkgs': ['leapp-upgrade-el7toel8'], + 'deps': ['leapp-upgrade-el7toel8-deps']}, + '8': {'pkgs': ['leapp-upgrade-el8toel9'], + 'deps': ['leapp-upgrade-el8toel9-deps']} + }, + LeappComponents.COCKPIT: {'7': {'pkgs': ['cockpit-leapp']}, + '8': {'pkgs': ['cockpit-leapp']} + }, + LeappComponents.TOOLS: {'7': {'pkgs': ['snactor']}, + '8': {'pkgs': ['snactor']} + } } -LEAPP_DEFAULT_COMPONENTS = ['framework', 'repository', 'tools'] +LEAPP_DEFAULT_COMPONENTS = [LeappComponents.FRAMEWORK, + LeappComponents.REPOSITORY, + LeappComponents.TOOLS] def get_installed_rpms():