fix: only print routes that match the runtime config (#2226)

# What does this PR do?

We now only print the 'active' routes, not all the possible routes. This
is based on the distribution server config by looking at enabled APIs
and their respective providers.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-05-22 00:30:29 +02:00 committed by GitHub
parent 37f1e8a7f7
commit 02e5e8a633
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,7 +31,7 @@ async def get_provider_impl(config, deps):
class DistributionInspectImpl(Inspect):
def __init__(self, config, deps):
def __init__(self, config: DistributionInspectConfig, deps):
self.config = config
self.deps = deps
@ -39,12 +39,26 @@ class DistributionInspectImpl(Inspect):
pass
async def list_routes(self) -> ListRoutesResponse:
run_config = self.config.run_config
run_config: StackRunConfig = self.config.run_config
ret = []
all_endpoints = get_all_api_endpoints()
for api, endpoints in all_endpoints.items():
# Always include provider and inspect APIs, filter others based on run config
if api.value in ["providers", "inspect"]:
ret.extend(
[
RouteInfo(
route=e.route,
method=e.method,
provider_types=[], # These APIs don't have "real" providers - they're internal to the stack
)
for e in endpoints
]
)
else:
providers = run_config.providers.get(api.value, [])
if providers: # Only process if there are providers for this API
ret.extend(
[
RouteInfo(