From: Sven Velt Date: Fri, 3 Sep 2010 13:53:04 +0000 (+0200) Subject: Fix for config file reading X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b0463dffec77b4885f26044b97eded3da55be0eb;p=nagixsc.git Fix for config file reading --- diff --git a/nagixsc_conf2http.py b/nagixsc_conf2http.py index c87959b..7698d43 100755 --- a/nagixsc_conf2http.py +++ b/nagixsc_conf2http.py @@ -46,10 +46,10 @@ config = { 'pidfile': '/var/run/nagixsc_conf2http.pid' } -if 'ip' in cfgread.items('server'): +if 'ip' in cfgread.options('server'): config['ip'] = cfgread.get('server', 'ip') -if 'port' in cfgread.items('server'): +if 'port' in cfgread.options('server'): config['port'] = cfgread.get('server', 'port') try: config['port'] = int(config['port']) @@ -57,7 +57,7 @@ except ValueError: print 'Port "%s" not an integer!' % config['port'] sys.exit(127) -if 'ssl' in cfgread.items('server'): +if 'ssl' in cfgread.options('server'): try: config['ssl'] = cfgread.getboolean('server', 'ssl') except ValueError: @@ -65,7 +65,7 @@ if 'ssl' in cfgread.items('server'): sys.exit(127) if config['ssl']: - if 'sslcert' in cfgread.items('server'): + if 'sslcert' in cfgread.options('server'): config['sslcert'] = cfgread.get('server', 'sslcert') else: print 'SSL but no certificate file specified!' @@ -77,7 +77,7 @@ except ConfigParser.NoOptionError: print 'No "conf_dir" specified!' sys.exit(127) -if 'pidfile' in cfgread.items('server'): +if 'pidfile' in cfgread.options('server'): config['pidfile'] = cfgread.get('server', 'pidfile') diff --git a/nagixsc_http2nagios.py b/nagixsc_http2nagios.py index dd05e62..df8e2d3 100755 --- a/nagixsc_http2nagios.py +++ b/nagixsc_http2nagios.py @@ -46,10 +46,10 @@ config = { 'pidfile': '/var/run/nagixsc_conf2http.pid' } -if 'ip' in cfgread.items('server'): +if 'ip' in cfgread.options('server'): config['ip'] = cfgread.get('server', 'ip') -if 'port' in cfgread.items('server'): +if 'port' in cfgread.options('server'): config['port'] = cfgread.get('server', 'port') try: config['port'] = int(config['port']) @@ -57,7 +57,7 @@ except ValueError: print 'Port "%s" not an integer!' % config['port'] sys.exit(127) -if 'ssl' in cfgread.items('server'): +if 'ssl' in cfgread.options('server'): try: config['ssl'] = cfgread.getboolean('server', 'ssl') except ValueError: @@ -65,7 +65,7 @@ if 'ssl' in cfgread.items('server'): sys.exit(127) if config['ssl']: - if 'sslcert' in cfgread.items('server'): + if 'sslcert' in cfgread.options('server'): config['sslcert'] = cfgread.get('server', 'sslcert') else: print 'SSL but no certificate file specified!'