1
0
mirror of https://github.com/VerosK/nagios-snmp-tortilla.git synced 2024-11-22 02:13:48 +01:00

added test of readable config file - fixes #2

This commit is contained in:
Veros Kaplan 2014-03-03 17:01:16 +01:00
parent 132b9a08a3
commit e911bd33ba

View File

@ -124,8 +124,13 @@ def main():
print 'Error: Need to set config file\n\n' print 'Error: Need to set config file\n\n'
parser.print_help() parser.print_help()
raise SystemExit(ERROR) raise SystemExit(ERROR)
config = ConfigParser() 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, test = Device(config=config, host=options.host,
snmp_community=options.snmp_community) snmp_community=options.snmp_community)
raise SystemExit, test.run_checks() raise SystemExit, test.run_checks()