mitogen-hq / mitogen

Distributed self-replicating programs in Python
https://mitogen.networkgenomics.com/
BSD 3-Clause "New" or "Revised" License
2.32k stars 197 forks source link

ansible k8s fails with mitogen #569

Open varac opened 5 years ago

varac commented 5 years ago

I'm using this ansible k8s ansible resource:

- name: Install Tiller                                                                                                                                                                   
  tags:                                                                                                                                                                                  
    - tiller                                                                                                                                                                             
  k8s:                                                                                                                                                                                   
    state: present                                                                                                                                                                       
    definition: "{{ lookup('file', 'k8s-config/tiller-permissions.yml') }}"                                                                                                              

It works fine without mitogen, but fails once I use mitogen:

  msg: This module requires the OpenShift Python client. Try `pip install openshift`
    to retry, use: --limit @/builds/openappstack/bootstrap/test/bootstrap.retry

See attached verbose log for more details.

2.7.9

No

No

Do you mean ansible master or mitogen master ? I didn't try any.

No

Host: Docker image based on alpine:3.9 Target: Ubuntu 18.04

Host: 3.6.8 Target: 3.6.7

DEFAULT_CALLBACK_WHITELIST(/builds/openappstack/bootstrap/test/ansible.cfg) = ['profile_tasks', 'timer']
DEFAULT_HOST_LIST(/builds/openappstack/bootstrap/test/ansible.cfg) = ['/builds/openappstack/bootstrap/test/inventory.yml']
DEFAULT_STDOUT_CALLBACK(/builds/openappstack/bootstrap/test/ansible.cfg) = yaml
DEFAULT_STRATEGY(/builds/openappstack/bootstrap/test/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/builds/openappstack/bootstrap/test/ansible.cfg) = ['/builds/openappstack/bootstrap/test/plugins/mitogen-0.2.6/ansible_mitogen/plugins/strategy']

mitogen-k8s.log

varac commented 5 years ago

Oh, maybe it's worth mentioning that we use ansible_python_interpreter: "/usr/bin/env python3" as group var.

varac commented 5 years ago

Also, all other playbook resources work fine, k8s is the only one that fails with mitogen.

jpic commented 5 years ago

so, does it work when you patch it to install openshift with the pip module prior to the call to the k8s module that requires the openshift python client?

Le mar. 19 mars 2019 à 23:26, Varac notifications@github.com a écrit :

Also, all other playbook resources work fine, k8s is the only one that fails with mitogen.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dw/mitogen/issues/569#issuecomment-474608871, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFxrNpFUYGcJKZtW5XL4DS44nYOxEHKks5vYWQfgaJpZM4b9O-V .

varac commented 5 years ago

I forgot to mention that openshift is already installed in the docker image as pip3 module. This was neccessary to make it work before, without mitogen. With mitogen it fails.

varac commented 5 years ago

I'm still hit by this, here's the task output from ansible-playbook run with -vvv: k8s-mitogen-py3.log

varac commented 5 years ago

I could reproduce the same behaviuour with a debian stable host instead of ubuntu 18.04.

varac commented 5 years ago

@jpic Could it be that mitogen can't deal with the situation that openshift got installed in the same playbook run ? Cause when I re-run the playbook everything is fine. Can I use a different strategy for this particular task so it creates a new connection i.e. ?

varac commented 5 years ago

For now I'm using this workaround:

I install the openshift pip3 package in a dedicated role in the very first beginning, with the standard ansible linear strategy. After this, all subsequent roles are using mitogen_linear strategy, which works fine this way. When I use mitogen_linear in this setup also for the first role, it breaks.

dw commented 5 years ago

@varac sorry for the huge delay. It possibly looks like a different import error is being masked.

Unfortunately Ansible has this horrible idiom of turning any error into a simple 'not installed' boolean, so this has happened a few times.

Can you try editing module_utils/k8s/common.py of your Ansible install, and inserting the word raise on a new line immediately above HAS_K8S_MODULE_HELPER = False, with indentation matching the line below, and rerun.

You should get a huge stack trace because now it is crashing, and the stack trace should report the true import error

chrono2002 commented 3 years ago

same for me