plone / ansible.plone_server

Ansible role to create a plone server
Other
9 stars 16 forks source link

Fix 122 superlance path py3 #137

Closed stevepiercy closed 4 years ago

stevepiercy commented 4 years ago

This PR addresses https://github.com/plone/ansible-playbook/issues/122

If plone_python_version == '3', then append an argument to install superlance that specifies the path to pip3.

smcmahon commented 4 years ago

The CI framework is now working, and we've got a failing test. Can we also make sure that the tests in test.yml cover superlance with python 3?

stevepiercy commented 4 years ago

Can the tests be run locally?

I thought that it would be possible to use Jinja2 syntax in a .yml file, but apparently logic is not supported here. Should I fall back to using a when condition?

I'm not sure how to proceed. My guess failed. Any hint appreciated.

smcmahon commented 4 years ago

Regarding testing: if you've got vagrant available, the easiest thing to do is to run "vagrant up". That will run the tests against bionic. After "up", use "vagrant provision" to run again against the same box instance.

stevepiercy commented 4 years ago

Thanks for the tip for running the tests. I had to fallback to using when and duplicate the blocks. It's not as pretty, but, meh, whatever.

Travis-CI build succeeds now.

smcmahon commented 4 years ago

In trying to add a test for superlance under Python 3, I ran into some issues.

If supervisor is being added as a system package (which it is), it seems to me that we want to add superlance using the same version of pip/python as is in use for the system package.

And, if that's python3, we want to use the system pip3 -- not the one in the virtualenv. If it gets added in the virtualenv, it will not be found by the system install of supervisor.

(Separate issue: mightn't we want to simply drop the superlance version of the hot_monitor in favor of the cron version. Because the latter knows how to work with haproxy and warm zodb caches, it seems superior to me. This was never spelled out, but I've long regarded the superlance mechanism as a legacy.)

stevepiercy commented 4 years ago

What issues did you run into?

What is the variable to use for a system path? I assumed that removing the executable parameter would use the system $PATH, but without an executable parameter I get the error message:

fatal: [bionic]: FAILED! => {"changed": false, "msg": "Unable to find any of pip2, pip to use. pip needs to be installed."}

Here's $PATH from the return of a debug statement:

"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin",

When I hard-code executable=/usr/bin/pip3, pip is found and the playbook proceeds. That's fine for Debian/Ubuntu, but what should I use for other OSes?

smcmahon commented 4 years ago

Issue resolved! Thanks for getting this going.