-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix disabled timeouts in ansible.builtin.expect #80983
Conversation
Fixes ansible#80982. See that issue for a more complete description of the problem.
The test
|
This may be a breaking change for people who already do |
Since pexpect allows a timeout of 0 (no wait) in addition to None (wait indefinitely), a backwards compatible option might be to make timeout type diffdiff --git a/lib/ansible/modules/expect.py b/lib/ansible/modules/expect.py
index c9aac71ac5..120192f71e 100644
--- a/lib/ansible/modules/expect.py
+++ b/lib/ansible/modules/expect.py
@@ -43,7 +43,7 @@ options:
responses. List functionality is new in 2.1.
required: true
timeout:
- type: int
+ type: raw
description:
- Amount of time in seconds to wait for the expected strings. Use
C(null) to disable timeout.
@@ -122,6 +122,7 @@ except ImportError:
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_bytes, to_native
+from ansible.module_utils.common.validation import check_type_int
def response_closure(module, question, responses):
@@ -147,7 +148,7 @@ def main():
creates=dict(type='path'),
removes=dict(type='path'),
responses=dict(type='dict', required=True),
- timeout=dict(type='int', default=30),
+ timeout=dict(type='raw', default=30),
echo=dict(type='bool', default=False),
)
)
@@ -162,6 +163,11 @@ def main():
removes = module.params['removes']
responses = module.params['responses']
timeout = module.params['timeout']
+ if timeout is not None:
+ try:
+ timeout = check_type_int(timeout)
+ except TypeError as te:
+ module.fail_json(msg=to_native(te))
echo = module.params['echo']
events = dict() |
Thanks for the bug report. This has been fixed in #82522. |
SUMMARY
Fixes #80982. See that issue for a more complete description of the problem.
ISSUE TYPE
COMPONENT NAME
ansible.builtin.expect