Skip to content

Commit e710fad

Browse files
Add configurable timeout support
Signed-off-by: Stew Francis <[email protected]>
1 parent dcbabab commit e710fad

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

plugins/doc_fragments/cmci.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ class ModuleDocFragment(object):
113113
type: bool
114114
required: false
115115
default: false
116+
timeout:
117+
description: HTTP request timeout in seconds
118+
type: int
119+
required: false
120+
default: 30
116121
'''
117122

118123
RESOURCES = r'''

plugins/module_utils/cmci.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
COMPLEX_FILTER = 'complex_filter'
4545
SCHEME = 'scheme'
4646
INSECURE = 'insecure'
47+
TIMEOUT = 'timeout'
4748

4849
GET_PARAMETERS = 'get_parameters'
4950

@@ -261,6 +262,10 @@ def init_argument_spec(self): # type: () -> Dict
261262
INSECURE: {
262263
'type': 'bool',
263264
'default': False
265+
},
266+
TIMEOUT: {
267+
'type': 'int',
268+
'default': 30
264269
}
265270
}
266271

@@ -489,7 +494,7 @@ def _do_request(self): # type: () -> Dict
489494
self._method,
490495
self._url,
491496
verify=not self._p[INSECURE],
492-
timeout=30,
497+
timeout=self._p[TIMEOUT],
493498
data=self._body
494499
)
495500

0 commit comments

Comments
 (0)