Changeset

11628:0807e835d3b5

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.
author Kim Alvefur <zash@zash.se>
date Mon, 21 Jun 2021 22:43:26 +0200
parents 11627:3a5212fd7e8e
children 11629:e6e56e2dd996
files plugins/mod_external_services.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_external_services.lua	Mon Jun 21 22:41:59 2021 +0200
+++ b/plugins/mod_external_services.lua	Mon Jun 21 22:43:26 2021 +0200
@@ -103,12 +103,14 @@
 	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