From 902655da5909f79ffde6a06d527bd1dbe9ee5f8a Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 29 Sep 2014 19:23:35 +0200 Subject: [PATCH] idviews: Display the list of hosts when using --all Enumerating hosts is a potentially expensive operation (uses paged search to list all the hosts the ID view applies to). Show the list of the hosts only if explicitly asked for (or asked for --all). Do not display with --raw, since this attribute does not exist in LDAP. Part of: https://fedorahosted.org/freeipa/ticket/3979 Reviewed-By: Petr Viktorin Reviewed-By: Petr Vobornik Reviewed-By: Alexander Bokovoy --- ipalib/plugins/idviews.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ipalib/plugins/idviews.py b/ipalib/plugins/idviews.py index 0a387b142..9c9747daf 100644 --- a/ipalib/plugins/idviews.py +++ b/ipalib/plugins/idviews.py @@ -205,7 +205,14 @@ class idview_show(LDAPRetrieve): def post_callback(self, ldap, dn, entry_attrs, *keys, **options): self.show_id_overrides(dn, entry_attrs) - if options.get('show_hosts', False): + # Enumerating hosts is a potentially expensive operation (uses paged + # search to list all the hosts the ID view applies to). Show the list + # of the hosts only if explicitly asked for (or asked for --all). + # Do not display with --raw, since this attribute does not exist in + # LDAP. + + if ((options.get('show_hosts') or options.get('all')) + and not options.get('raw')): self.enumerate_hosts(dn, entry_attrs) return dn