mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
wgi/plugins.py: ignore empty plugin directories
Dynamic plugin registry returns as a plugin any folder within the plugins directory. Web UI then attempts to load for each plugin 'foo' a JavaScript file named 'foo/foo.js'. The problem is that if 'foo/foo.js' does not exist, Web UI breaks and it is impossible to recover until the empty folder is removed or 'foo/foo.js' (even empty) is created at the server side. Check that 'foo/foo.js' actual exists when including a plugin into the registry. Test the registry generator by creating fake plugins and removing them during the test. Fixes: https://pagure.io/freeipa/issue/8567 Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
81cbee4e3f
commit
91706690e0
@@ -36,7 +36,10 @@ def get_plugin_index():
|
||||
|
||||
dirs = os.listdir(paths.IPA_JS_PLUGINS_DIR)
|
||||
index = 'define([],function(){return['
|
||||
index += ','.join("'"+x+"'" for x in dirs)
|
||||
for x in dirs:
|
||||
p = os.path.join(paths.IPA_JS_PLUGINS_DIR, x, x + '.js')
|
||||
if os.path.exists(p):
|
||||
index += "'" + x + "',"
|
||||
index += '];});'
|
||||
return index.encode('utf-8')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user