From 584f95211383a3363be39c39a0409f65d1793de0 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 7 Feb 2016 18:01:12 -0800 Subject: [PATCH] conf: check to make sure logging block exists in config --- conf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 35007ae..a85effc 100644 --- a/conf.py +++ b/conf.py @@ -50,16 +50,21 @@ testconf = {'bot': def validateConf(conf): """Validates a parsed configuration dict.""" assert type(conf) == dict, "Invalid configuration given: should be type dict, not %s." % type(conf).__name__ - for section in ('bot', 'servers', 'login'): + + for section in ('bot', 'servers', 'login', 'logging'): assert conf.get(section), "Missing %r section in config." % section + for netname, serverblock in conf['servers'].items(): for section in ('ip', 'port', 'recvpass', 'sendpass', 'hostname', 'sid', 'sidrange', 'protocol', 'maxnicklen'): assert serverblock.get(section), "Missing %r in server block for %r." % (section, netname) + assert type(serverblock.get('channels')) == list, "'channels' option in " \ "server block for %s must be a list, not %s." % (netname, type(serverblock['channels']).__name__) + assert type(conf['login'].get('password')) == type(conf['login'].get('user')) == str and \ conf['login']['password'] != "changeme", "You have not set the login details correctly!" + return conf def loadConf(fname, errors_fatal=True):