Skip to content

Ansible+Mitogen ignores interpreter_python global config #740

@jlu5

Description

@jlu5

Hello,

I'm running the Git version of Mitogen as of commit a60c6c1. It seems that after the changes in #658, Ansible+Mitogen respects the ansible_interpreter_python variable, but not the [defaults]/interpreter_python of ansible.cfg, as described in https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html#interpreter-discovery. Although this can be easily worked around, I do find the current behaviour a bit confusing.


I'm running ansible 2.9.9+dfsg-1 from Debian unstable on my host:

$ ansible --version
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/james/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Aug  2 2020, 15:09:07) [GCC 10.2.0]

The target machines run Debian 10 with Python 2.7.16 and 3.7.3 installed.

Expected behaviour (strategy=linear)

$ ansible staging -m setup -a 'filter=ansible_python_version'
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "3.7.3"
    },
    "changed": false
}
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "3.7.3"
    },
    "changed": false
}

Behaviour with strategy=mitogen_linear:

$ ansible staging -m setup -a 'filter=ansible_python_version'
[WARNING]: Platform linux on host redacted.hostname is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "2.7.16",
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false
}
[WARNING]: Platform linux on host redacted.hostname is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "2.7.16",
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false
}

Editted by @moreati: clarify variable vs config distinction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCode feature that hinders desired execution outcomeuser-reported

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions