[config] rename logfile to log and outputpath to output

This commit is contained in:
Thor77 2016-05-10 22:56:48 +02:00
parent d836b807be
commit cbb44fcb85
4 changed files with 14 additions and 17 deletions

View File

@ -25,9 +25,9 @@ def main(config_path='config.ini', id_map_path='id_map.json'):
else: else:
id_map = {} id_map = {}
log_path, output_path = parse_config(config_path) log, output = parse_config(config_path)
clients = parse_logs(log_path, ident_map=id_map) clients = parse_logs(log, ident_map=id_map)
render_template(clients, output=output_path) render_template(clients, output=output)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -12,10 +12,8 @@ def parse_config(config_path):
config = ConfigParser() config = ConfigParser()
config.read(config_path) config.read(config_path)
if not config.has_section('General') or not \ if not config.has_section('General') or not \
(config.has_option('General', 'logfile') and (config.has_option('General', 'log') and
config.has_option('General', 'outputfile')): config.has_option('General', 'output')):
raise InvalidConfig raise InvalidConfig
return (abspath(config.get('General', 'log')),
log_path = abspath(config.get('General', 'logfile')) abspath(config.get('General', 'output')))
output_path = abspath(config.get('General', 'outputfile'))
return log_path, output_path

View File

@ -1,3 +1,3 @@
[General] [General]
logfile = tsstats/tests/res/test.log log = tsstats/tests/res/test.log
outputfile = tsstats/tests/res/output.html output = tsstats/tests/res/output.html

View File

@ -42,10 +42,9 @@ def test_invalid_config(config):
def test_config(config): def test_config(config):
create_config({ create_config({
'logfile': 'tsstats/tests/res/test.log', 'log': 'tsstats/tests/res/test.log',
'outputfile': 'output.html', 'output': 'output.html',
'debug': 'true'
}) })
log_path, output_path = parse_config(configpath) log, output = parse_config(configpath)
assert log_path == abspath('tsstats/tests/res/test.log') assert log == abspath('tsstats/tests/res/test.log')
assert output_path == abspath('output.html') assert output == abspath('output.html')