Skip to content

Commit

Permalink
Unify access to ubiconfig in Matcher subclasses
Browse files Browse the repository at this point in the history
Previously methods of ModularMatcher class accessed ubiconfig via
ubiconfig.modules, but RpmMatcher used ubiconfig directly.
So let's unify the access and use ubiconfig directly also
in ModularMatcher.
  • Loading branch information
rbikar committed Sep 1, 2021
1 parent 1502e8d commit a92ddd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions tests/test_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_search_moludemds(pulp):

def test_modular_rpms_filenames(ubi_config):
"""Test getting filename from module artifacts, srpms are skipped."""
matcher = ModularMatcher(None, ubi_config.modules)
matcher = ModularMatcher(None, ubi_config)
unit = UbiUnit(
ModulemdUnit(
name="test",
Expand Down Expand Up @@ -311,7 +311,7 @@ def test_modular_rpms_filenames(ubi_config):

def test_modular_rpms_filenames_per_profiles(ubi_config):
"""Test getting filename from module artifacts, limited by profiles"""
matcher = ModularMatcher(None, ubi_config.modules)
matcher = ModularMatcher(None, ubi_config)
unit = UbiUnit(
ModulemdUnit(
name="fake_name",
Expand Down Expand Up @@ -345,7 +345,7 @@ def test_modular_rpms_filenames_per_profiles(ubi_config):

def test_modular_rpms_filenames_per_profiles_missing_profile(ubi_config):
"""Test getting filename from module artifacts, request for non-existing profile in modulemd"""
matcher = ModularMatcher(None, ubi_config.modules)
matcher = ModularMatcher(None, ubi_config)
unit = UbiUnit(
ModulemdUnit(
name="fake_name",
Expand Down Expand Up @@ -480,7 +480,7 @@ def test_get_modulemd_output_set():

def test_get_modulemds_criteria(ubi_config):
"""Test proper creation of criteria for modulemds query"""
matcher = ModularMatcher(None, ubi_config.modules)
matcher = ModularMatcher(None, ubi_config)
criteria = matcher._get_modulemds_criteria()
# there should be 1 criterium created based on ubi config
assert len(criteria) == 1
Expand All @@ -492,7 +492,7 @@ def test_get_modulemds_criteria(ubi_config):

def test_get_modular_srpms_criteria(ubi_config):
"""Testing creation of criteria for srpms query"""
matcher = ModularMatcher(None, ubi_config.modules)
matcher = ModularMatcher(None, ubi_config)
unit_1 = UbiUnit(
RpmUnit(
name="test",
Expand Down Expand Up @@ -530,7 +530,7 @@ def test_get_modular_srpms_criteria(ubi_config):

def test_get_modular_rpms_criteria(ubi_config):
"""Test creation of criteria for rpms query"""
matcher = ModularMatcher(None, ubi_config.modules)
matcher = ModularMatcher(None, ubi_config)
unit = UbiUnit(
ModulemdUnit(
name="test",
Expand Down Expand Up @@ -622,7 +622,7 @@ def test_modular_matcher_run(pulp, ubi_config):
pulp.insert_units(repo_3, [unit_3])

repos_set = RepoSet(rpm=[repo_1], debug=[repo_2], source=[repo_3])
matcher = ModularMatcher(repos_set, ubi_config.modules)
matcher = ModularMatcher(repos_set, ubi_config)
matcher.run()

# each public attribute is properly set with one unit
Expand Down
2 changes: 1 addition & 1 deletion ubipop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def run_ubi_population(self):
) = self._get_current_content()

# start async querying for modulemds and modular and non-modular packages
mm = ModularMatcher(self.repos.in_repos, self.ubiconfig.modules).run()
mm = ModularMatcher(self.repos.in_repos, self.ubiconfig).run()
rm = RpmMatcher(self.repos.in_repos, self.ubiconfig).run()

self.repos.modules = mm.modules
Expand Down
4 changes: 2 additions & 2 deletions ubipop/_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _get_modular_rpms_criteria(self):

def _get_modulemds_criteria(self):
criteria_values = []
for module in self._ubi_config:
for module in self._ubi_config.modules:
criteria_values.append(
(
module.name,
Expand Down Expand Up @@ -267,7 +267,7 @@ def _keep_n_latest_modules(self, modules, n=1):
def _modular_rpms_filenames(self, modules):
config_map = {}

for module_config in self._ubi_config:
for module_config in self._ubi_config.modules:
key = module_config.name + module_config.stream
config_map[key] = module_config.profiles

Expand Down

0 comments on commit a92ddd0

Please sign in to comment.