[config] rename logfile to log and outputpath to output
This commit is contained in:
parent
d836b807be
commit
cbb44fcb85
|
@ -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__':
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue