Operator-sdk: Ansible operator (v0.13.0) k8s module apply attribute needs more recent openshift python library

Created on 10 Jan 2020  路  5Comments  路  Source: operator-framework/operator-sdk

Bug Report

What did you do?

- name: Apply objects
  k8s:
    definition: "{{ obj }}"
    apply: yes

What did you expect to see?

The task succeeding.

What did you see instead? Under which circumstances?

It failed with:

"Failed to import the required Python library (openshift >= 0.9.2) on zuul-6c89b45dc8-2l2cs's Python /usr/bin/python3.6. This is required for apply. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"

Environment

The image is built with: quay.io/operator-framework/ansible-operator:v0.13.0
And it contains: openshift-0.8.9

Possible Solution
Add to the Containerfile:

USER root
RUN pip3 install --upgrade openshift
USER 1001
good first issue kinbug languagansible

Most helpful comment

@geerlingguy it only happens with the apply attribute.

$ podman images | head
REPOSITORY                                    TAG       IMAGE ID       CREATED       SIZE
quay.io/operator-framework/ansible-operator   v0.13.0   6cfd80eb704f   4 weeks ago   507 MB

$ echo 'import openshift; print(openshift.__version__)' | podman run --rm -it --entrypoint python3 quay.io/operator-framework/ansible-operator:v0.13.0
import openshift; print(openshift.__version__)
Python 3.6.8 (default, Oct 11 2019, 15:04:54) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openshift; print(openshift.__version__)
0.8.9

All 5 comments

Just noting that I haven't had this issue on my builds, not sure why not...?

@geerlingguy it only happens with the apply attribute.

$ podman images | head
REPOSITORY                                    TAG       IMAGE ID       CREATED       SIZE
quay.io/operator-framework/ansible-operator   v0.13.0   6cfd80eb704f   4 weeks ago   507 MB

$ echo 'import openshift; print(openshift.__version__)' | podman run --rm -it --entrypoint python3 quay.io/operator-framework/ansible-operator:v0.13.0
import openshift; print(openshift.__version__)
Python 3.6.8 (default, Oct 11 2019, 15:04:54) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openshift; print(openshift.__version__)
0.8.9

I have same problem with v0.15.1.

When can we expect this issue to be fixed in a released version? I notice that https://github.com/operator-framework/operator-sdk/pull/2479 is merged to master, but not (yet) included in any release....

Hi @erikgb,

We have not an ETA for the next release. However, it do not take too long to occurs usually and it is solved in the master. If you still trying to get this info after this explanation I would suggest you raise a new issue and then we will try to address it.

Was this page helpful?
0 / 5 - 0 ratings