Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gathering Facts / converge action stop to work after upgrade python version from 2 to 3 #2322

Closed
camilamacedo86 opened this issue Sep 20, 2019 · 3 comments
Labels

Comments

@camilamacedo86
Copy link

camilamacedo86 commented Sep 20, 2019

Issue Type

  • Bug report

Molecule and Ansible details

ansible: 2.8.0 and 2.8.5
molecule: 2.20 and 2.22 

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

Desired Behavior

After upgrade, the python version used in the solution from 2 to 3 all tests should still work as the coverage one.

Actual Behaviour

The coverage stop to work when the only change is the python version.

--> Action: 'converge'
    
    PLAY [Build Operator in Kubernetes docker container] ***************************
    
    TASK [Gathering Facts] *********************************************************
    ok: [kind-test-local]
    
    TASK [Get existing image hash] *************************************************
    ok: [kind-test-local]
    
    TASK [Build Operator Image] ****************************************************
    changed: [kind-test-local]
    
    PLAY [Converge] ****************************************************************
    
    TASK [Gathering Facts] *********************************************************
    ok: [localhost]
    
    TASK [Delete the Operator Deployment] ******************************************
    ok: [localhost]
    
    TASK [Wait 30s for Operator Deployment to terminate] ***************************
    skipping: [localhost]
    
    TASK [Create the Operator Deployment] ******************************************
    changed: [localhost]
    
    TASK [Create the ansible.example.com/v1alpha1.Memcached] ***********************
    changed: [localhost]
    
    TASK [Wait 3m for reconciliation to run] ***************************************
    FAILED - RETRYING: Wait 3m for reconciliation to run (10 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (9 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (8 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (7 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (6 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (5 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (4 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (3 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (2 retries left).
    FAILED - RETRYING: Wait 3m for reconciliation to run (1 retries left).
    fatal: [localhost]: FAILED! => {"attempts": 10, "changed": false, "resources": [{"apiVersion": "ansible.example.com/v1alpha1", "kind": "Memcached", "metadata": {"creationTimestamp": "2019-09-20T17:00:22Z", "finalizers": ["finalizer.ansible.example.com"], "generation": 1, "name": "example-memcached", "namespace": "default", "resourceVersion": "787", "selfLink": "/apis/ansible.example.com/v1alpha1/namespaces/default/memcacheds/example-memcached", "uid": "21fb17c2-dbc8-11e9-8c04-02422e706c63"}, "spec": {"size": 3}, "status": {"conditions": [{"lastTransitionTime": "2019-09-20T17:00:25Z", "message": "Running reconciliation", "reason": "Running", "status": "False", "type": "Running"}, {"ansibleResult": {"changed": 0, "completion": "2019-09-20T17:00:40.201574", "failures": 1, "ok": 0, "skipped": 0}, "lastTransitionTime": "2019-09-20T17:00:41Z", "message": "Failed to import the required Python library (openshift) on memcached-operator-f5ffb768c-8x6d6's Python /usr/bin/python. Please read module documentation and install in the appropriate location", "reason": "Failed", "status": "True", "type": "Failure"}]}}]}

IMPORTANT

@camilamacedo86 camilamacedo86 changed the title Gathering Facts / converge action stop to work after upgrade python version Gathering Facts / converge action stop to work after upgrade python version from 2 to 3 Sep 20, 2019
@camilamacedo86
Copy link
Author

c/c @fabianvf

@fabianvf
Copy link
Contributor

I think we just need to set the ansible_python_interpreter inside the operator container to point to the python3 location, instead of the default /usr/bin/python. If we installed ansible with pip3, I believe merging this PR might fix it: operator-framework/operator-sdk#1828

@camilamacedo86
Copy link
Author

We could confirm that the this issue is not caused by molecule. Ansible will not use python3 by unless it is defined to be used by ansible_python_interpreter. See its docs: https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#using-python-3-on-the-managed-machines-with-commands-and-playbooks

So, the issue was occurring because besides all be done with python3 it has been executed by ansible with python2.

Closing this issue now. However, would be great if molecule could show it in an error msg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants