basic: Handle exception in default selector (#72101)

In Python 2.7, default selector raises IOError
instead of OSError. Fix handles this exception.

Fixes: #71704

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2020-10-06 20:55:51 +05:30 committed by GitHub
parent ebc91a9b93
commit 9ffa84cc1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- basic - handle exceptions for default selectors in Python 2.7 (https://github.com/ansible/ansible/issues/71704).

View file

@ -2712,7 +2712,7 @@ class AnsibleModule(object):
stderr = b''
try:
selector = selectors.DefaultSelector()
except OSError:
except (IOError, OSError):
# Failed to detect default selector for the given platform
# Select PollSelector which is supported by major platforms
selector = selectors.PollSelector()