Mercurial > prosody-hg
comparison util/prosodyctl/check.lua @ 14043:d8a30fdfbddd 13.0
util.prosodyctl.check: Fix #1978
Fixes an error that occurs when modules_enabled is not present in the
global section nor in a Component section, leading to an attempt to
index nil.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 13 Jan 2026 22:55:14 +0100 |
| parents | 2afb278326ce |
| children | f5d415d54064 48ea7a15957e |
comparison
equal
deleted
inserted
replaced
| 14042:2afb278326ce | 14043:d8a30fdfbddd |
|---|---|
| 473 "websocket_frame_fragment_limit", | 473 "websocket_frame_fragment_limit", |
| 474 "websocket_get_response_body", | 474 "websocket_get_response_body", |
| 475 "websocket_get_response_text", | 475 "websocket_get_response_text", |
| 476 }); | 476 }); |
| 477 local config = configmanager.getconfig(); | 477 local config = configmanager.getconfig(); |
| 478 local global = api("*"); | |
| 479 -- Check that we have any global options (caused by putting a host at the top) | 478 -- Check that we have any global options (caused by putting a host at the top) |
| 480 if it.count(it.filter("log", pairs(config["*"]))) == 0 then | 479 if it.count(it.filter("log", pairs(config["*"]))) == 0 then |
| 481 ok = false; | 480 ok = false; |
| 482 print(""); | 481 print(""); |
| 483 print(" No global options defined. Perhaps you have put a host definition at the top") | 482 print(" No global options defined. Perhaps you have put a host definition at the top") |
| 536 validate_module_list(host, "modules_enabled", options.modules_enabled); | 535 validate_module_list(host, "modules_enabled", options.modules_enabled); |
| 537 validate_module_list(host, "modules_disabled", options.modules_disabled); | 536 validate_module_list(host, "modules_disabled", options.modules_disabled); |
| 538 end | 537 end |
| 539 | 538 |
| 540 do -- Check for modules enabled both normally and as components | 539 do -- Check for modules enabled both normally and as components |
| 541 local modules = global:get_option_set("modules_enabled"); | 540 for host in enabled_hosts() do |
| 542 for host, options in enabled_hosts() do | 541 local modules, component_module = modulemanager.get_modules_for_host(host); |
| 543 local component_module = options.component_module; | |
| 544 if component_module and modules:contains(component_module) then | 542 if component_module and modules:contains(component_module) then |
| 545 print((" mod_%s is enabled both in modules_enabled and as Component %q %q"):format(component_module, host, component_module)); | 543 print((" mod_%s is enabled both in modules_enabled and as Component %q %q"):format(component_module, host, component_module)); |
| 546 print(" This means the service is enabled on all VirtualHosts as well as the Component."); | 544 print(" This means the service is enabled on all VirtualHosts as well as the Component."); |
| 547 print(" Are you sure this what you want? It may cause unexpected behaviour."); | 545 print(" Are you sure this what you want? It may cause unexpected behaviour."); |
| 548 end | 546 end |
