1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Update HostManager to return only a single matching hostname for SmartInventory filter

This commit is contained in:
Wayne Witzel III 2017-08-21 01:53:21 -04:00
parent 031b5f3269
commit c352ea7596
No known key found for this signature in database
GPG Key ID: B4F07BDC564D6301
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

@ -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