From 5cf7f85a081fcf56c44bca7bc5738cf3af25d630 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 12 Jan 2016 01:13:57 +0100 Subject: prosodyctl check: Fix traceback if the global modules_enabled is unset --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 0c80aca7..e08c9dd2 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1080,8 +1080,8 @@ function commands.check(arg) target_hosts:remove("localhost"); end - local modules = set.new(it.to_array(it.values(host_options.modules_enabled))) - + set.new(it.to_array(it.values(config.get("*", "modules_enabled")))) + local modules = set.new(it.to_array(it.values(host_options.modules_enabled or {}))) + + set.new(it.to_array(it.values(config.get("*", "modules_enabled") or {}))) + set.new({ config.get(host, "component_module") }); if modules:contains("proxy65") then -- cgit v1.2.3 From 78ab7365489a289f91459839f635411afc65a94c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 12 Jan 2016 23:47:30 +0100 Subject: prosodyctl: check config: Suggest moving modules enabled on all hosts to a global_modules enabled if that is unset --- prosodyctl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index e08c9dd2..1a487fb5 100755 --- a/prosodyctl +++ b/prosodyctl @@ -877,6 +877,20 @@ function commands.check(arg) print(" All hosts are disabled. Remove enabled = false from at least one VirtualHost section") end end + if not config["*"].modules_enabled then + print(" No global modules_enabled is set?"); + local suggested_global_modules; + for host, options in enabled_hosts() do + if not options.component_module and options.modules_enabled then + suggested_global_modules = set.intersection(suggested_global_modules or set.new(options.modules_enabled), set.new(options.modules_enabled)); + end + end + if not suggested_global_modules:empty() then + print(" Consider moving these modules into modules_enabled in the global section:") + print(" "..tostring(suggested_global_modules / function (x) return ("%q"):format(x) end)); + end + print(); + end -- Check for global options under hosts local global_options = set.new(it.to_array(it.keys(config["*"]))); local deprecated_global_options = set.intersection(global_options, deprecated); -- cgit v1.2.3