summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Babinsky <mbabinsk@redhat.com>2016-03-18 09:56:08 +0100
committerMartin Basti <mbasti@redhat.com>2016-04-13 17:52:22 +0200
commit62bb478e112cd4677e681f4750c5f5e5c9221607 (patch)
treee91d8bf788c5306a161b14c62489a22c6dd08811
parent1f0959735f9828a09439f17f1468dcd3dfb914db (diff)
downloadfreeipa-62bb478e112cd4677e681f4750c5f5e5c9221607.tar.gz
freeipa-62bb478e112cd4677e681f4750c5f5e5c9221607.tar.xz
freeipa-62bb478e112cd4677e681f4750c5f5e5c9221607.zip
specify type of exceeded limit when warning about truncated search results
API commands inheriting from LDAPSearch should mention which limit was exceeded in the warning message sent with truncated results. https://fedorahosted.org/freeipa/ticket/5677 Reviewed-By: Petr Spacek <pspacek@redhat.com>
-rw-r--r--ipalib/messages.py2
-rw-r--r--ipalib/plugins/baseldap.py7
-rw-r--r--ipatests/test_xmlrpc/test_old_permission_plugin.py8
-rw-r--r--ipatests/test_xmlrpc/test_permission_plugin.py8
4 files changed, 14 insertions, 11 deletions
diff --git a/ipalib/messages.py b/ipalib/messages.py
index 872b455c1..c37cceb3f 100644
--- a/ipalib/messages.py
+++ b/ipalib/messages.py
@@ -338,7 +338,7 @@ class SearchResultTruncated(PublicMessage):
errno = 13017
type = "warning"
- format = _("Search result has been truncated to configured search limit.")
+ format = _("Search result has been truncated: %(reason)s")
class BrokenTrust(PublicMessage):
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 0eae45dbd..dc61fe454 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -2104,8 +2104,11 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
truncated=bool(truncated),
)
- if truncated:
- add_message(options['version'], result, SearchResultTruncated())
+ try:
+ ldap.handle_truncated_result(truncated)
+ except errors.LimitsExceeded as e:
+ add_message(options['version'], result, SearchResultTruncated(
+ reason=e))
return result
diff --git a/ipatests/test_xmlrpc/test_old_permission_plugin.py b/ipatests/test_xmlrpc/test_old_permission_plugin.py
index 09f43fee8..1af76f6a6 100644
--- a/ipatests/test_xmlrpc/test_old_permission_plugin.py
+++ b/ipatests/test_xmlrpc/test_old_permission_plugin.py
@@ -525,8 +525,8 @@ class test_old_permission(Declarative):
},
],
messages=({
- 'message': (u'Search result has been truncated to '
- 'configured search limit.'),
+ 'message': (u'Search result has been truncated: '
+ u'Configured size limit exceeded'),
'code': 13017,
'type': u'warning',
'name': u'SearchResultTruncated'
@@ -585,8 +585,8 @@ class test_old_permission(Declarative):
api.env.basedn)) and
'ipapermission' in res['objectclass']],
messages=({
- 'message': (u'Search result has been truncated to '
- 'configured search limit.'),
+ 'message': (u'Search result has been truncated: '
+ u'Configured size limit exceeded'),
'code': 13017,
'type': u'warning',
'name': u'SearchResultTruncated'
diff --git a/ipatests/test_xmlrpc/test_permission_plugin.py b/ipatests/test_xmlrpc/test_permission_plugin.py
index 8026e8436..df5498a61 100644
--- a/ipatests/test_xmlrpc/test_permission_plugin.py
+++ b/ipatests/test_xmlrpc/test_permission_plugin.py
@@ -818,8 +818,8 @@ class test_permission(Declarative):
],
messages=(
{
- 'message': (u'Search result has been truncated to '
- 'configured search limit.'),
+ 'message': (u'Search result has been truncated: '
+ u'Configured size limit exceeded'),
'code': 13017,
'type': u'warning',
'name': u'SearchResultTruncated'
@@ -882,8 +882,8 @@ class test_permission(Declarative):
'ipapermission' in res['objectclass']],
messages=(
{
- 'message': (u'Search result has been truncated to '
- 'configured search limit.'),
+ 'message': (u'Search result has been truncated: '
+ u'Configured size limit exceeded'),
'code': 13017,
'type': u'warning',
'name': u'SearchResultTruncated'