-
Notifications
You must be signed in to change notification settings - Fork 199
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
ansible_mitogen: Interpreter discovery improvements #1225
Comments
auto fallbackMitogen defaults to 'auto' discovery mode under some circumstances. This may override Ansible's default, which I don't think is desirable. mitogen/ansible_mitogen/transport_config.py Lines 142 to 144 in fca7578
Changing this (e.g. to raise an Exception) currently results in atleast one test failure. --- a/ansible_mitogen/transport_config.py
+++ b/ansible_mitogen/transport_config.py
@@ -140,8 +140,7 @@ def parse_python_path(s, task_vars, action, rediscover_python):
discovery value in `facts_from_task_vars` like how Ansible handles this.
"""
if not s:
- # if python_path doesn't exist, default to `auto` and attempt to discover it
- s = 'auto'
+ raise ValueError("Expected Python path or discovery mode, got: %r", s)
s = run_interpreter_discovery_if_necessary(s, task_vars, action, rediscover_python)
if not s:
-- https://github.com/mitogen-hq/mitogen/actions/runs/12950225330/job/36122554610?pr=1226 refs |
#!/bin/sh
p=$(for p in python4 python3 python2; do command -v "${p}" 2>/dev/null && break; done;)
if [ "${p}" ]; then
exec "${p}" "$@"
else
echo "Not found" 1>&2
exit 1
fi |
A grab bag of shortcomings, ideas, and a place to disucss them
Finding python to find python
Ansible's native interpreter discovery makes one call to
sh
, with a list of candidate interepreters from INTERPRETER_PYTHON_FALLBACK. Mitogen turns this into several attempts to call a list of (Mitogen) candidate interpreters. So an O(1) operation becomes O(N).sh
with Ansible's snippet insteadmitogen/ansible_mitogen/mixins.py
Lines 461 to 476 in 0953a93
/usr/bin/python fallback
Depending on the setting INTERPRETER_PYTHON Ansible may fallback to
/usr/bin/python
or (I think) throw an error. I'm not convinced Mitogen always respects that setting.mitogen/ansible_mitogen/transport_config.py
Lines 146 to 149 in 0953a93
related
The text was updated successfully, but these errors were encountered: