2016-10-19 12:19:45 +03:00
|
|
|
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)
|
|
|
|
|
2016-10-19 02:11:49 +03:00
|
|
|
|
2016-10-19 12:19:45 +03:00
|
|
|
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) + ',')
|