From 287f3a609ed08e5ff8dbe484b5fdd0c359c973a5 Mon Sep 17 00:00:00 2001 From: Clement Trebuchet Date: Tue, 30 Jan 2018 23:21:45 +0100 Subject: [PATCH] Fixes #35468: ADD max_results to the nios api (#35473) * Fixes #35468: ADD max_results to the nios api * Fixes #35468: fix nios unittest * Fixes #35468: document the module docs fragments for nios --- lib/ansible/module_utils/net_tools/nios/api.py | 3 ++- lib/ansible/utils/module_docs_fragments/nios.py | 9 +++++++++ test/units/module_utils/net_tools/nios/test_api.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/net_tools/nios/api.py b/lib/ansible/module_utils/net_tools/nios/api.py index 83be2b8794d..101decd0d96 100644 --- a/lib/ansible/module_utils/net_tools/nios/api.py +++ b/lib/ansible/module_utils/net_tools/nios/api.py @@ -50,7 +50,8 @@ nios_provider_spec = { 'http_pool_connections': dict(type='int', default=10), 'http_pool_maxsize': dict(type='int', default=10), 'max_retries': dict(type='int', default=3), - 'wapi_version': dict(default='1.4') + 'wapi_version': dict(default='1.4'), + 'max_results': dict(type='int', default=1000) } diff --git a/lib/ansible/utils/module_docs_fragments/nios.py b/lib/ansible/utils/module_docs_fragments/nios.py index 82c9ef6405e..3b37b7fe57f 100644 --- a/lib/ansible/utils/module_docs_fragments/nios.py +++ b/lib/ansible/utils/module_docs_fragments/nios.py @@ -76,6 +76,15 @@ options: variable. required: false default: 1.4 + max_results: + description: + - Specifies the maximum number of objects to be returned, + if set to a negative number the appliance will return an error when the + number of returned objects would exceed the setting. + - Value can also be specified using C(INFOBLOX_MAX_RESULTS) environment + variable. + required: false + default: 1000 notes: - "This module must be run locally, which can be achieved by specifying C(connection: local)." """ diff --git a/test/units/module_utils/net_tools/nios/test_api.py b/test/units/module_utils/net_tools/nios/test_api.py index a93d4b3ac87..8dbb6b4525e 100644 --- a/test/units/module_utils/net_tools/nios/test_api.py +++ b/test/units/module_utils/net_tools/nios/test_api.py @@ -32,7 +32,7 @@ class TestNiosApi(unittest.TestCase): def test_get_provider_spec(self): provider_options = ['host', 'username', 'password', 'ssl_verify', 'silent_ssl_warnings', 'http_request_timeout', 'http_pool_connections', - 'http_pool_maxsize', 'max_retries', 'wapi_version'] + 'http_pool_maxsize', 'max_retries', 'wapi_version', 'max_results'] res = api.WapiBase.provider_spec self.assertIsNotNone(res) self.assertIn('provider', res)