Skip to content

Commit

Permalink
Provide an endpoint to list critpath components
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>
  • Loading branch information
mattiaverga committed Sep 8, 2023
1 parent f3342ba commit d8c70c9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bodhi-server/bodhi/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ def main(global_config, testing=None, session=None, **settings):
config.add_route('liveness', '/healthz/live')
config.add_route('readyness', '/healthz/ready')

# service endpoints
config.add_route('get_critpath_components', '/get_critpath_components')

# Legacy: Redirect the previously self-hosted documentation
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/hybrid.html#using-subpath-in-a-route-pattern
config.add_route("docs", "/docs/*subpath")
Expand Down
19 changes: 19 additions & 0 deletions bodhi-server/bodhi/server/views/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,22 @@ def docs(request):
subpath = "/".join(request.subpath)
url = f"https://fedora-infra.github.io/bodhi/{major_minor_version}/{subpath}"
raise HTTPMovedPermanently(url)


@view_config(route_name='get_critpath_components', renderer='json')
def get_critpath_components(request):
"""
Return critical path components configured in bodhi.
Args:
request (pyramid.request.Request): The current request.
Returns:
dict: A dictionary with a "version" key indexing a string of the Bodhi version.
"""
collection = request.params.get('collection', 'master')
component_type = request.params.get('component_type', 'rpm')
components = request.params.get('components')
if components is not None:
components = components.split(',')
return bodhi.server.util.get_grouped_critpath_components(collection, component_type,
components)

0 comments on commit d8c70c9

Please sign in to comment.