added check for config.ini
This commit is contained in:
@@ -72,11 +72,12 @@ configPath = os.path.join(cwd, 'config.ini')
|
|||||||
# import the config file
|
# import the config file
|
||||||
logger.debug("Starting to read the ini config.")
|
logger.debug("Starting to read the ini config.")
|
||||||
logger.debug("Using file {0}.".format(configPath))
|
logger.debug("Using file {0}.".format(configPath))
|
||||||
try:
|
if os.path.exists(configPath):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(cwd + '/config.ini')
|
config.read(cwd + '/config.ini')
|
||||||
except ValueError:
|
else:
|
||||||
logger.critical("Unable to find/read config file. ")
|
logger.critical("Unable to find/read config file. Please ensure the config.ini is in the same directory as this script and readable.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
serverDNS = config['LDAP SERVER']['server']
|
serverDNS = config['LDAP SERVER']['server']
|
||||||
serverPort = config['LDAP SERVER'].getint('port')
|
serverPort = config['LDAP SERVER'].getint('port')
|
||||||
|
|||||||
Reference in New Issue
Block a user