2016-05-08 15:32:37 -04:00
|
|
|
from os.path import abspath
|
|
|
|
|
|
|
|
from tsstats.exceptions import InvalidConfig
|
|
|
|
|
|
|
|
try:
|
|
|
|
from configparser import ConfigParser
|
|
|
|
except ImportError:
|
|
|
|
from ConfigParser import ConfigParser
|
|
|
|
|
|
|
|
|
|
|
|
def parse_config(config_path):
|
|
|
|
config = ConfigParser()
|
|
|
|
config.read(config_path)
|
2016-05-09 13:25:48 -04:00
|
|
|
if not config.has_section('General') or not \
|
2016-05-10 16:56:48 -04:00
|
|
|
(config.has_option('General', 'log') and
|
|
|
|
config.has_option('General', 'output')):
|
2016-05-08 15:32:37 -04:00
|
|
|
raise InvalidConfig
|
2016-05-10 16:56:48 -04:00
|
|
|
return (abspath(config.get('General', 'log')),
|
|
|
|
abspath(config.get('General', 'output')))
|