Skip to content

Commit 42b20cf

Browse files
committed
Map skip YumSyncOption to type_skip_list [ROK-1828]
The skip option for yum repo sync was passed to the rhsm-pulp API as 'skip', but the rhsm-pulp API expects 'type_skip_list'. To correct the disparity, YumSyncOption's 'skip' attribute has been mapped to 'type_skip_list' via the 'pulp_field' parameter, and the sync method has been updated to respect 'pulp_field' metadata when converting sync options to rhsm-pulp API parameters.
1 parent c4c1b02 commit 42b20cf

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- n/a
10+
### Fixed
11+
- YumSyncOption's `skip` parameter is now correctly passed to the rhsm-pulp API as `type_skip_list`
1112

1213
## [2.43.2] - 2026-01-21
1314

src/pubtools/pulplib/_impl/model/repository/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,17 @@ def sync(self, options=None):
651651
if not self._client:
652652
raise DetachedException()
653653

654-
return f_proxy(
655-
self._client._do_sync(
656-
self.id, asdict(options, filter=lambda name, val: val is not None)
657-
)
658-
)
654+
# Convert sync options to dict, respecting pulp_field metadata
655+
656+
sync_config = {}
657+
for field in attr.fields(type(options)):
658+
value = getattr(options, field.name)
659+
if value is not None:
660+
# Use pulp_field if available, otherwise use field name
661+
pulp_field = field.metadata.get(PULP2_FIELD, field.name)
662+
sync_config[pulp_field] = value
663+
664+
return f_proxy(self._client._do_sync(self.id, sync_config))
659665

660666
def lock(self, context, duration=None):
661667
"""

src/pubtools/pulplib/_impl/model/repository/yum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class YumSyncOptions(SyncOptions):
4343
"""Count indicating how many old rpm versions to retain.
4444
"""
4545

46-
skip = pulp_attrib(default=None, type=list)
46+
skip = pulp_attrib(default=None, type=list, pulp_field="type_skip_list")
4747
"""List of content types to be skipped during the repository synchronization
4848
"""
4949

tests/repository/test_sync.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ def test_sync_with_options(
6060
repo = YumRepository(id="some-repo")
6161
repo.__dict__["_client"] = client
6262

63-
options = YumSyncOptions(ssl_validation=False, feed="mock://example.com/")
63+
options = YumSyncOptions(
64+
ssl_validation=False, feed="mock://example.com/", skip=["drpm", "srpm"]
65+
)
6466

6567
# It should have succeeded, with the tasks as retrieved from Pulp
6668
assert repo.sync(options).result() == [
@@ -72,4 +74,6 @@ def test_sync_with_options(
7274
assert req[0].json()["override_config"] == {
7375
"ssl_validation": False,
7476
"feed": "mock://example.com/",
77+
# Verify that 'skip' is passed as 'type_skip_list' in the API call
78+
"type_skip_list": ["drpm", "srpm"],
7579
}

0 commit comments

Comments
 (0)