From c1cc92afa06e14ee9c399eb3b48b0ad6d481e00d Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 28 Mar 2018 17:02:32 -0400 Subject: [PATCH] properly filter disabled hosts on smart inventory composition see: #1053 related: https://github.com/ansible/tower/pull/1155 --- awx/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/api/views.py b/awx/api/views.py index f5fdcf6eb2..11a364f587 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -2408,7 +2408,7 @@ class InventoryScriptView(RetrieveAPIView): return Response({}) else: all_group = data.setdefault('all', dict()) - smart_hosts_qs = obj.hosts.all() + smart_hosts_qs = obj.hosts.filter(**hosts_q).all() smart_hosts = list(smart_hosts_qs.values_list('name', flat=True)) all_group['hosts'] = smart_hosts else: