ganglia/monitor-core — Issue #22: ganglia python plugin path should be prepended to python path
Author: discordianfish
Created: 2012-03-05 12:16:35+00:00
State: open

Hi,

I ran into a problem writing a python plugin. It had the same name as a system wide installed python module.

Since ganglia appends the plugin path to the python path, it will load system wide installed modules before it would load the actual plugin. Even worse, if you have a plugin called 'foo' and install, let's say month later, a python model 'foo' it will break the plugin.

https://github.com/ganglia/monitor-core/blob/master/gmond/modules/python/mod_python.c#L593 says:

PyObject *sys_path = PySys_GetObject("path");
PyObject *addpath = PyString_FromString(path);
PyList_Append(sys_path, addpath)

It should be easy to change that to prepend, instead of append, the plugin path without any downsides.