Skip to content

Commit

Permalink
Remove wrong/outdated build validation condition
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <[email protected]>
(cherry picked from commit 35f29df)
  • Loading branch information
mattiaverga authored and mergify[bot] committed Oct 12, 2024
1 parent a37559f commit 0e0b5b0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
11 changes: 0 additions & 11 deletions bodhi-server/bodhi/server/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,6 @@ def validate_build_nvrs(request, **kwargs):
for build in request.validated.get('builds') or []: # cope with builds being None
try:
cache_nvrs(request, build)
if request.validated.get('from_tag'):
n, v, r = request.buildinfo[build]['nvr']
release = request.db.query(Release).filter(or_(Release.name == r,
Release.name == r.upper(),
Release.version == r)).first()
if release and release.composed_by_bodhi:
request.errors.add(
'body', 'builds',
f"Can't create update from tag for release"
f" '{release.name}' composed by Bodhi.")

if trusted_sources:
build_source = request.buildinfo[build]['info']['source']
if not any(build_source.startswith(source) for source in trusted_sources):
Expand Down
19 changes: 0 additions & 19 deletions bodhi-server/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,25 +968,6 @@ def setup_method(self, method):
# We need release not composed by Bodhi
self.release = models.Release.query.one()

@mock.patch('bodhi.server.validators.cache_nvrs')
def test_build_from_release_composed_by_bodhi(self, mock_cache_nvrs):
"""Assert that release composed by Bodhi will not be validated when from_tag is provided."""
self.request.validated = {'from_tag': 'f17-build-side-7777',
'builds': ['foo-1-1.f17']}
self.request.buildinfo = {'foo-1-1.f17': {
'nvr': ('foo', '1-1', 'f17'),
'info': {'source': 'git+https://src.fedoraproject.org/rpms/foo.git#aabbccdd'}
}}
self.release.composed_by_bodhi = True
validators.validate_build_nvrs(self.request)

assert self.request.errors == [
{'location': 'body', 'name': 'builds',
'description':
f"Can't create update from tag for release"
f" '{self.release.name}' composed by Bodhi."}
]

@mock.patch.dict(
'bodhi.server.validators.config',
{'trusted_build_sources': ['git+https://src.fedoraproject.org/']})
Expand Down
1 change: 1 addition & 0 deletions news/5725.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a build validation issue which would prevent a sidetag update from being submitted in some circumstances

0 comments on commit 0e0b5b0

Please sign in to comment.