mirror of
https://github.com/xcat2/confluent.git
synced 2025-07-24 05:11:14 +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:
@@ -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/']
|
||||
|
Reference in New Issue
Block a user