Software /
code /
prosody
Comparison
prosodyctl @ 6159:4ee14b7ef2cc
prosodyctl: Add check that points out any disabled hosts
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 May 2014 08:16:26 +0200 |
parent | 6158:08e9c9d0beb3 |
child | 6160:cf0f7caa885e |
comparison
equal
deleted
inserted
replaced
6158:08e9c9d0beb3 | 6159:4ee14b7ef2cc |
---|---|
797 local array, set = require "util.array", require "util.set"; | 797 local array, set = require "util.array", require "util.set"; |
798 local it = require "util.iterators"; | 798 local it = require "util.iterators"; |
799 local ok = true; | 799 local ok = true; |
800 local function disabled_hosts(host, conf) return host ~= "*" and conf.enabled ~= false; end | 800 local function disabled_hosts(host, conf) return host ~= "*" and conf.enabled ~= false; end |
801 local function enabled_hosts() return it.filter(disabled_hosts, pairs(config.getconfig())); end | 801 local function enabled_hosts() return it.filter(disabled_hosts, pairs(config.getconfig())); end |
802 if not what or what == "disabled" then | |
803 local disabled_hosts = set.new(); | |
804 for host, host_options in it.filter("*", pairs(config.getconfig())) do | |
805 if host_options.enabled == false then | |
806 disabled_hosts:add(host); | |
807 end | |
808 end | |
809 if not disabled_hosts:empty() then | |
810 local msg = "Checks will be skipped for these disabled hosts: %s"; | |
811 if what then msg = "These hosts are disabled: %s"; end | |
812 show_warning(msg, tostring(disabled_hosts)); | |
813 if what then return 0; end | |
814 print"" | |
815 end | |
816 end | |
802 if not what or what == "config" then | 817 if not what or what == "config" then |
803 print("Checking config..."); | 818 print("Checking config..."); |
804 local known_global_options = set.new({ | 819 local known_global_options = set.new({ |
805 "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", | 820 "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", |
806 "umask", "prosodyctl_timeout", "use_ipv6", "use_libevent", "network_settings" | 821 "umask", "prosodyctl_timeout", "use_ipv6", "use_libevent", "network_settings" |