ansible-collections / community.kubernetes

Kubernetes Collection for Ansible
https://galaxy.ansible.com/community/kubernetes
GNU General Public License v3.0
265 stars 104 forks source link

No module named google.auth #284

Closed nergalex closed 4 years ago

nergalex commented 4 years ago
SUMMARY

CONTEXT first install and play with community.kubernetes collection. It doesn't work before. (see attached playbook get_test.yaml)

SYMPTOM job output No module named google.auth (see attached file job_24196_output.txt)

WORKAROUND add __init__.py in package google. File copied from https://raw.githubusercontent.com/googleapis/google-auth-library-python/master/google/__init__.py job_24196_output.txt get_test.yaml.TXT

ISSUE TYPE
COMPONENT NAME

community.kubernetes.k8s_info

ANSIBLE VERSION
ansible 2.9.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/cyber/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Mar 20 2020, 17:08:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION

Tower 3.7.3

OS / ENVIRONMENT
Red Hat Enterprise Linux Server release 7.9 (Maipo)
STEPS TO REPRODUCE

create custom env

$ sudo virtualenv /opt/custom-envs/cloudbuilder-collection
$ source /opt/custom-envs/cloudbuilder-collection/bin/activate
$ pip install psutil openshift
$ deactivate

Play get_test.yaml with collection community.kubernetes 1.1.1 in requirements

EXPECTED RESULTS

With workaround: OK, it works.

ACTUAL RESULTS

See job_24196_output.txt

geerlingguy commented 4 years ago
Failed to import the required Python library (openshift) on towerrhel's Python /usr/bin/python.

It looks like the primary issue is the openshift Python library is not installed on the machine where the playbook runs. It should be installed with pip install openshift

If you install that library, it depends on the kubernetes library, which depends on google-auth, which would then be installed (see requirements.txt).

nergalex commented 4 years ago

openshift package is well installed but during module import, googlepackage is not found. In detailed_job_output.txt, you will find the detailed error:

      File \"/opt/custom-envs/cloudbuilder-collection/lib/python2.7/site-packages/kubernetes/config/kube_config.py\", line 29, in <module>
        from google import auth
        ImportError: No module named google

detailed_job_output.txt

tima commented 4 years ago

@nergalex Understood, but all of the things you are reporting -- Ansible Tower custom environment and the installation of the python openshift client library -- are outside of the scope of this project. Have you contacted Red Hat support on this?

nergalex commented 4 years ago

OK I will Thank you for your answer