vdstatus/vdstatus.py

23 lines
618 B
Python
Raw Normal View History

import json
2016-10-18 20:00:43 +03:00
import os
import configparser
import importlib
import plugins
DEFAULT_CONFIG = os.path.join(os.environ['HOME'], 'IdeaProjects/vdstatus/conf.ini')
configuration = configparser.ConfigParser()
configuration.read(DEFAULT_CONFIG)
def run_plugins():
outputs = list()
for section in configuration.sections():
if section == 'main':
continue
plugin_name = '.' + configuration.get(section, 'plugin')
plugin_module = importlib.import_module(plugin_name, 'plugins')
outputs.append(plugin_module.run(configuration, section))
print(json.dumps(outputs) + ',')