Skip to content

Commit

Permalink
Add 404 if no serializer found for dc-hosts endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed Nov 8, 2024
1 parent b1a59b1 commit 830dc58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ralph/assets/api/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import django_filters
from django.db.models import Prefetch
from rest_framework.exceptions import ValidationError
from rest_framework.exceptions import NotFound, ValidationError
from rest_framework.permissions import SAFE_METHODS

from ralph.api import RalphAPIViewSet
Expand Down Expand Up @@ -317,6 +317,8 @@ def get_serializer_class(self, *args, **kwargs):
elif isinstance(obj_, Cluster):
from ralph.data_center.api.serializers import ClusterSerializer
return ClusterSerializer
else:
raise NotFound()
except AssertionError: # for some reason when opening browsable api this raises
pass
return serializers.DCHostSerializer
Expand Down

0 comments on commit 830dc58

Please sign in to comment.