[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:
id_map = {}
log_path, output_path = parse_config(config_path)
clients = parse_logs(log_path, ident_map=id_map)
render_template(clients, output=output_path)
log, output = parse_config(config_path)
clients = parse_logs(log, ident_map=id_map)
render_template(clients, output=output)
if __name__ == '__main__':

View File

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

View File

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

View File

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