mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Update HostManager to return only a single matching hostname for SmartInventory filter
This commit is contained in:
parent
031b5f3269
commit
c352ea7596
@ -1936,7 +1936,7 @@ class HostList(ListCreateAPIView):
|
|||||||
if filter_string:
|
if filter_string:
|
||||||
filter_qs = SmartFilter.query_from_string(filter_string)
|
filter_qs = SmartFilter.query_from_string(filter_string)
|
||||||
qs &= filter_qs
|
qs &= filter_qs
|
||||||
return qs.distinct()
|
return qs.order_by('pk').distinct()
|
||||||
|
|
||||||
def list(self, *args, **kwargs):
|
def list(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
|
@ -42,7 +42,7 @@ class HostManager(models.Manager):
|
|||||||
# injected by the related object mapper.
|
# injected by the related object mapper.
|
||||||
self.core_filters = {}
|
self.core_filters = {}
|
||||||
qs = qs & q
|
qs = qs & q
|
||||||
return qs.distinct()
|
return qs.order_by('pk').distinct('name')
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user