From e911bd33ba9d73782a0d93d06b9e002bec191bf3 Mon Sep 17 00:00:00 2001 From: Veros Kaplan Date: Mon, 3 Mar 2014 17:01:16 +0100 Subject: [PATCH] added test of readable config file - fixes #2 --- src/check_snmp_tortilla | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/check_snmp_tortilla b/src/check_snmp_tortilla index 910bce1..e2f4e0d 100755 --- a/src/check_snmp_tortilla +++ b/src/check_snmp_tortilla @@ -124,8 +124,13 @@ def main(): print 'Error: Need to set config file\n\n' parser.print_help() raise SystemExit(ERROR) + config = ConfigParser() - config.read([options.config_file]) + parsed = config.read([options.config_file]) + if len(parsed) == 0: + print "Error: Unable to read config '%s'" % options.config_file + raise SystemExit(ERROR) + test = Device(config=config, host=options.host, snmp_community=options.snmp_community) raise SystemExit, test.run_checks()