willthames / kubernetes-validate

Other
45 stars 5 forks source link

kubernetes-validate 1.28.1 fails to import #27

Closed faust64 closed 10 months ago

faust64 commented 10 months ago

Hi,

I am using Ansible kubernetes module, with some "validate" option that relies on kubernetes-validate https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html#parameter-validate

As of upgrading kubernetes-validate from 1.27.1 to 1.28.1, I noticed my playbooks would fail with an error such as

failed to import the required Python library (kubernetes-validate) on [my_hostname]'s Python /usr/bin/python3. Please read the module documentation and installl it in the appropriate location ... if the module is installed ... consult the documentation on ansible_python_interpreter)

I did attempt to rebuild that image, same issue showing.

Using ansible core, 2.15.0. Python 3.9.18 and Python 3.11.15 are present in image. When I do some ansible --version, python 3.9 is the one in use ... while in doubt, all "pip install" we have building this image would run for both python versions, ... I can confirm pip3.9 list and pip3.11 list would both show kubernetes-validate to be installed.

Downgrading to 1.28.0, my playbooks are happy with this. I'm not yet sure what could be wrong here ... In doubt asking here, does this ring a bell?!

willthames commented 10 months ago

Hi @faust64 ok, I've reproduced this - I missed a dependency in the most recent merged PR.

The quick fix is to install the typing_extensions module.

I'll release a fixed 1.28.2 shortly that adds the dependency on that module (and also see if I can work out how to add a test for that kind of problem)

faust64 commented 10 months ago

oh, great! thanks a lot!

willthames commented 10 months ago

28 fixed this problem (including a change to the test suite so that this is less likely to happen in future) and I've just pushed 1.28.2 to pypi

faust64 commented 10 months ago

looks great, thanks again!