From 56f8f8d3f499541e9918e16496773d75637a2c40 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Fri, 21 Jan 2022 15:19:59 -0500 Subject: [PATCH] Turn off the filtering of hop nodes from the Instance endpoints except for the health check. --- awx/api/views/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 30eee980e2..7993a25de6 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -365,14 +365,11 @@ class InstanceList(ListAPIView): serializer_class = serializers.InstanceSerializer search_fields = ('hostname',) - def get_queryset(self): - return super().get_queryset().exclude(node_type='hop') - class InstanceDetail(RetrieveUpdateAPIView): name = _("Instance Detail") - queryset = models.Instance.objects.exclude(node_type='hop') + model = models.Instance serializer_class = serializers.InstanceSerializer def update(self, request, *args, **kwargs): @@ -418,10 +415,14 @@ class InstanceInstanceGroupsList(InstanceGroupMembershipMixin, SubListCreateAtta class InstanceHealthCheck(GenericAPIView): name = _('Instance Health Check') - queryset = models.Instance.objects.exclude(node_type='hop') + model = models.Instance serializer_class = serializers.InstanceHealthCheckSerializer permission_classes = (IsSystemAdminOrAuditor,) + def get_queryset(self): + # FIXME: For now, we don't have a good way of checking the health of a hop node. + return super().get_queryset().exclude(node_type='hop') + def get(self, request, *args, **kwargs): obj = self.get_object() data = self.get_serializer(data=request.data).to_representation(obj)