diff options
author | Kim Alvefur <zash@zash.se> | 2021-06-21 22:43:26 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-06-21 22:43:26 +0200 |
commit | eded7e2738b2820a406b12f0828101505cfc7c7d (patch) | |
tree | c1ee930735250f4800b8789add91b7905306774c /plugins | |
parent | 44675f7dbfbb706d415e7b95c7a5243ac166e45a (diff) | |
download | prosody-eded7e2738b2820a406b12f0828101505cfc7c7d.tar.gz prosody-eded7e2738b2820a406b12f0828101505cfc7c7d.zip |
mod_external_services: Report overall status as a module status
Because during startup, if all items are provided by a different module
(e.g. mod_turn_external) then this would log a scary warning even if
everything is fine after that other module has been loaded.
This way, any persistent problematic state is reported in the console.
Errors with individual items should still be reported by prepare().
Now, if you load mod_external_services alone without configuring any
services, no error or warning is reported in the log, but maybe that's
not so bad with it reported in the console.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_external_services.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mod_external_services.lua b/plugins/mod_external_services.lua index 1aab6380..1a6c80bd 100644 --- a/plugins/mod_external_services.lua +++ b/plugins/mod_external_services.lua @@ -103,12 +103,14 @@ function module.load() local extras = module:get_host_items("external_service"); local services = ( configured_services + extras ) / prepare; if #services == 0 then - module:log("warn", "No services configured or all had errors"); + module:set_status("warn", "No services configured or all had errors"); end end module:handle_items("external_service", function(added) - prepare(added.item); + if prepare(added.item) then + module:set_status("core", "OK"); + end end, module.load); -- Ensure only valid items are added in events |