Skip to content

Commit

Permalink
Make _LEAPP_DEFAULT_COMPONENTS global immutable.
Browse files Browse the repository at this point in the history
Making this value immutable has two benefits:
* Users won't accidentally modify this if they're looking for an easy way to pass a slight
  modification to the default components.
* We can use it directly as the default parameter value in the get_leapp_packages() function
  definition.

I think we should also make this variable public so users are encouraged to use this for making
minor modifications but we don't have agreement on the name yet.  So I'll do that in a separate
commit or we can do it in a future PR.
  • Loading branch information
abadger committed Jan 8, 2024
1 parent 59fb2ba commit 4731acd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions repos/system_upgrade/common/libraries/rpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ class LeappComponents(object):
'8': {'pkgs': ['snactor']}
}
}
_LEAPP_DEFAULT_COMPONENTS = [LeappComponents.FRAMEWORK,
LeappComponents.REPOSITORY,
LeappComponents.TOOLS]

_LEAPP_DEFAULT_COMPONENTS = frozenset((LeappComponents.FRAMEWORK,
LeappComponents.REPOSITORY,
LeappComponents.TOOLS))


def get_installed_rpms():
Expand Down Expand Up @@ -155,7 +156,7 @@ def check_file_modification(config):
return _parse_config_modification(output, config)


def get_leapp_packages(major_version=None, component=None, include_deps=False):
def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS, include_deps=False):
"""
Get list of leapp packages.
Expand All @@ -174,9 +175,6 @@ def get_leapp_packages(major_version=None, component=None, include_deps=False):
# requested
major_versions = [get_source_major_version()]
components = [component] if isinstance(component, str) else component
if not component:
# No component of interest specified -> return default leapp components
components = _LEAPP_DEFAULT_COMPONENTS
for comp in components:
for a_major_version in major_versions:
if comp not in _LEAPP_PACKAGES_MAP:
Expand Down

0 comments on commit 4731acd

Please sign in to comment.