Diff

plugins/mod_admin_shell.lua @ 13128:38582771b593

mod_admin_shell: Warn when (un-)loading module would be undone by restart Reminder to update the configuration if the change is to be permanent.
author Kim Alvefur <zash@zash.se>
date Tue, 06 Jun 2023 22:00:54 +0200
parent 13117:7eb6244b4984
child 13132:5bfcfd12c423
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Sat Jun 03 21:53:20 2023 +0200
+++ b/plugins/mod_admin_shell.lua	Tue Jun 06 22:00:54 2023 +0200
@@ -599,6 +599,8 @@
 	-- Load the module for each host
 	local ok, err, count, mod = true, nil, 0;
 	for host in hosts do
+		local configured_modules, component = modulemanager.get_modules_for_host(host);
+
 		if (not modulemanager.is_loaded(host, name)) then
 			mod, err = modulemanager.load(host, name);
 			if not mod then
@@ -613,6 +615,10 @@
 			else
 				count = count + 1;
 				self.session.print("Loaded for "..mod.module.host);
+
+				if not (configured_modules:contains(name) or name == component) then
+					self.session.print("Note: Module will not be loaded after restart unless enabled in configuration");
+				end
 			end
 		end
 	end
@@ -626,6 +632,8 @@
 	-- Unload the module for each host
 	local ok, err, count = true, nil, 0;
 	for host in hosts do
+		local configured_modules, component = modulemanager.get_modules_for_host(host);
+
 		if modulemanager.is_loaded(host, name) then
 			ok, err = modulemanager.unload(host, name);
 			if not ok then
@@ -634,6 +642,10 @@
 			else
 				count = count + 1;
 				self.session.print("Unloaded from "..host);
+
+				if configured_modules:contains(name) or name == component then
+					self.session.print("Note: Module will be loaded after restart unless disabled in configuration");
+				end
 			end
 		end
 	end