[2.10] basic: use PollSelector implementation (#70800)
Some platform such as ESXi does not implement EpollSelector,
which is selected by DefaultSelector. Use PollSelector.
This works perfectly with a platform like VMware ESXi.
Fixes: #70238
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 8cccede0d4
)
This commit is contained in:
parent
61f8f8ce7f
commit
18dd73c147
2 changed files with 9 additions and 1 deletions
2
changelogs/fragments/70238_selector.yml
Normal file
2
changelogs/fragments/70238_selector.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- basic - use PollSelector implementation when DefaultSelector fails (https://github.com/ansible/ansible/issues/70238).
|
|
@ -2603,7 +2603,13 @@ class AnsibleModule(object):
|
||||||
|
|
||||||
stdout = b''
|
stdout = b''
|
||||||
stderr = b''
|
stderr = b''
|
||||||
selector = selectors.DefaultSelector()
|
try:
|
||||||
|
selector = selectors.DefaultSelector()
|
||||||
|
except OSError:
|
||||||
|
# Failed to detect default selector for the given platform
|
||||||
|
# Select PollSelector which is supported by major platforms
|
||||||
|
selector = selectors.PollSelector()
|
||||||
|
|
||||||
selector.register(cmd.stdout, selectors.EVENT_READ)
|
selector.register(cmd.stdout, selectors.EVENT_READ)
|
||||||
selector.register(cmd.stderr, selectors.EVENT_READ)
|
selector.register(cmd.stderr, selectors.EVENT_READ)
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
|
|
Loading…
Reference in a new issue