Closed msimerson closed 9 years ago
Hmm, this may have nothing to do with inheritance:
Dec 17 16:19:06 node haraka[59474]: [INFO] [-] [core] Detected change, reloading /usr/local/haraka/config/karma.ini
Dec 17 16:19:06 node haraka[89450]: [INFO] [-] [core] Detected change, reloading /usr/local/haraka/config/karma.ini
Dec 17 16:19:06 node haraka[89450]: [CRIT] [-] [core] TypeError: Cannot call method 'loginfo' of undefined
Dec 17 16:19:06 node haraka[89450]: [CRIT] [-] [core] at exports.load_karma_ini (/usr/local/lib/node_modules/Haraka/plugins/karma.js:28:12)
Dec 17 16:19:06 node haraka[89450]: [CRIT] [-] [core] at FSWatcher.<anonymous> (/usr/local/lib/node_modules/Haraka/configfile.js:36:39)
Dec 17 16:19:06 node haraka[89450]: [CRIT] [-] [core] at FSWatcher.emit (events.js:98:17)
Dec 17 16:19:06 node haraka[89450]: [CRIT] [-] [core] at FSEvent.FSWatcher._handle.onchange (fs.js:1050:12)
Dec 17 16:19:06 node haraka[89450]: [NOTICE] [-] [core] Shutting down
Dec 17 16:19:06 node haraka[59474]: [CRIT] [-] [core] TypeError: Cannot call method 'loginfo' of undefined
Dec 17 16:19:06 node haraka[59474]: [CRIT] [-] [core] at exports.load_karma_ini (/usr/local/lib/node_modules/Haraka/plugins/karma.js:28:12)
Dec 17 16:19:06 node haraka[59474]: [CRIT] [-] [core] at FSWatcher.<anonymous> (/usr/local/lib/node_modules/Haraka/configfile.js:36:39)
Dec 17 16:19:06 node haraka[59474]: [CRIT] [-] [core] at FSWatcher.emit (events.js:98:17)
Dec 17 16:19:06 node haraka[59474]: [CRIT] [-] [core] at FSEvent.FSWatcher._handle.onchange (fs.js:1050:12)
Dec 17 16:19:06 node haraka[59474]: [NOTICE] [-] [core] Shutting down
Here's your bug:
plugin.cfg = plugin.config.get('karma.ini', {
booleans: [
'+asn.enable',
],
}, plugin.load_karma_ini);
It should be:
plugin.cfg = plugin.config.get('karma.ini', {
booleans: [
'+asn.enable',
],
}, function reload_config() {
plugin.load_karma_ini();
});
Hmm, that change needs to be made in a few plugins then...
It's not a new requirement - it would never have worked like that. You were passing the body of the function instead of calling the method inside a closure. In the former case plugin
becomes undefined because the function is called in the context of the caller.
I understand the difference, right after you showed the example code. But there's still a few plugins that must be updated to be closures. I'll work on that...
this happened in the plugins/rcpt_to.in_host_list plugin:
It happens immediately after the host_list file changes. I have temporarily worked around this by moving the function that loads the config (load_host_list) from the
rcpt_to.host_list_base.js
plugin into thercpt_to.in_host_list.js
plugin.