Pre-2.0 cleanup
This cleanup breaks backwards compatibility in less used features, but I think that it is acceptable for the upcoming 2.0 release.
Merge request reports
Activity
mentioned in commit aaf98192
@vavrusam might remember the reason for module naming. I see we first do
dlopen
on absolute paths, so that should be OK, but the next phase – loading a lua module might be prone to collisions with same-named files (etcd.lua
does exist upstream). Off the top of my head, I'm not certain about precedence in lua.Hmm, I did not realize that our
etcd
module depends on differentetcd
module. Luckily the other module is namedetcd.luasocket
so loading should still work.Module load order seems correct even if we are loading "submodule" below an existing parent (
io
).modules.load('io.blablabla') error: module 'io.blablabla' not found: no field package.preload['io.blablabla'] no file '/usr/local/lib/kdns_modules/io/blablabla.lua' no file '/usr/local/lib/kdns_modules/io/blablabla/init.lua' no file './io/blablabla.lua' no file '/usr/share/luajit-2.1.0-beta3/io/blablabla.lua' no file '/usr/local/share/lua/5.1/io/blablabla.lua' no file '/usr/local/share/lua/5.1/io/blablabla/init.lua' no file '/usr/share/lua/5.1/io/blablabla.lua' no file '/usr/share/lua/5.1/io/blablabla/init.lua' no file '/usr/local/lib/kdns_modules/io/blablabla.so' no file './io/blablabla.so' no file '/usr/local/lib/lua/5.1/io/blablabla.so' no file '/usr/lib64/lua/5.1/io/blablabla.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/usr/local/lib/kdns_modules/io.so' no file './io.so' no file '/usr/local/lib/lua/5.1/io.so' no file '/usr/lib64/lua/5.1/io.so' no file '/usr/local/lib/lua/5.1/loadall.so' error: No such file or directory
I will do couple experiments to make sure it works... Also, we should do thought-experiment to find out whether our Lua modules should loaded using
require('kdns_modules.<module_name>')
to avoid conflicts with global namespace... or maybekres_modules
so it is unique and not possibly mixed up with Knot DNS.BTW right now
modules.load('io')
silently succeeds and I do not like this kind of surprises.I think the reason was to avoid collision with the packages used by modules (
kmemcached
usesmemcached
etc). It'd be nicer solution to use the namespace as you said, that way modules can either domodules.load 'abcd'
orrequire('kdns_modules.abcd')
. The built-in packages (likekres
) should be includable without prefix though.mentioned in issue #279 (closed)