2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-11 18:28:11 +00:00

Fix conflicts with system python modules

If python system module had a name that conflicted in some way
with a plugin, the plugin load would fail.  Fix this by prioritizing
the plugin path over system locations.  Also, to avoid the breakage
going the other way, remove the plugindir from the system path when
that particular directory is done.
This commit is contained in:
Jarrod Johnson 2016-08-29 09:56:21 -04:00
parent 4d04c1fb18
commit 9e4ee7bb31

View File

@ -78,7 +78,7 @@ def load_plugins():
plugindir = os.path.join(plugintop, plugindir)
if not os.path.isdir(plugindir):
continue
sys.path.append(plugindir)
sys.path.insert(1, plugindir)
# two passes, to avoid adding both py and pyc files
for plugin in os.listdir(plugindir):
if plugin.startswith('.'):
@ -96,6 +96,8 @@ def load_plugins():
pluginmap[name] = tmpmod
else:
pluginmap[plugin] = tmpmod
# restore path to not include the plugindir
sys.path.pop(1)
rootcollections = ['noderange/', 'nodes/', 'nodegroups/', 'users/', 'events/']