From 23267bce387602514ce351b4f5b21748a81d1dc1 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 28 Mar 2018 15:16:26 -0400 Subject: [PATCH] properly filter disabled hosts on smart inventory composition see: https://github.com/ansible/tower/issues/1053 --- awx/main/models/inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index b63e8a48c0..83f5d65fd7 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -233,7 +233,7 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin, RelatedJobsMixin): return {} else: all_group = data.setdefault('all', dict()) - smart_hosts_qs = self.hosts.all() + smart_hosts_qs = self.hosts.filter(**hosts_q).all() smart_hosts = list(smart_hosts_qs.values_list('name', flat=True)) all_group['hosts'] = smart_hosts else: