supervisor state fails if supervisor is not installed in system python
This is new in 2014.7.0 (it was working in 2014.1.13).
I am managing processes with supervisor in a virtualenv where supervisor has been installed.
myserver:
supervisord:
- running
- bin_env: /opt/myenv
- conf_file: /opt/myenv/etc/supervisor/supervisor.conf
/opt/myenv does have supervisor installed:
# /opt/myenv/bin/pip freeze | grep supervisor
supervisor==3.1.3
Following error is shown in state.highstate results:
Supervisord module not activated. Do you need to install supervisord?
If I do /usr/bin/pip install supervisor in the system python and run highstate again, the error goes away and it looks like salt-minon is using supervisor installed in /opt/myenv/ to manage the processes.
I think this is new behavior and salt should not require supervisor installed in the system python (or the virtualenv from where salt is being run) if supervisor state is managing processes in virtual environment.
So I am seeing some changes in the loader for the supervisord module. In 2014.1, there was no __virtual__ function in that module -- it would always load, and then would try to obtain the supervisorctl binary dynamically at execution time.
In 2014.7, we switch this to just use a __virtual__ function which uses salt.utils.which('supervisorctl') to see if it is available. The problem with this is that it's more naive than before, because the previous dynamic generation would check the bin folder in your environment, if you passed in bin_env. It looks like the person who added the __virtual__ function didn't notice the fact that we can also check for the binary in a local environment.
I think the solution here is to rip that __virtual__ function back out, and basically go back to the old code. We don't know about the bin_env at load time, so we can't make the decision as to whether to load at that point.
Thanks for the report, we'll get this fixed.
In the meantime, you could sync the 2014.1 version of the supevisord module down to your minions as a custom module and I bet this would start working again.
I was able to work around this by doing "pip install supervisor" in the system python. From the debug output, salt-minion it looks like supervisor state does use the supervisor specified in bin_env to control the process.
I am not sure if this jives with your working theory about why it is broken but it worked.
Yep, I would expect that to work. I still think my theory is right. =)
I just did a little testing with 2014.7 - this bug appears to be the only thing that breaks my setup. The offending commit is probably 637c372.
Thanks for the update. This shouldn't be a difficult fix, I just have to find time.
Fixed. =) Will be in the 2014.7.2 release.
:+1: