get rid of thread_id and useless logic it used
This commit is contained in:
parent
bb9658d053
commit
0495bc2d79
7 changed files with 7 additions and 9 deletions
|
@ -5,7 +5,7 @@ BATTERY_DIR = '/sys/class/power_supply/BAT0/'
|
||||||
|
|
||||||
|
|
||||||
class PluginThread(plugins.common.PluginThreadCommon):
|
class PluginThread(plugins.common.PluginThreadCommon):
|
||||||
def __init__(self, section, config, thread_id):
|
def __init__(self, section, config):
|
||||||
super(PluginThread, self).__init__(section, config)
|
super(PluginThread, self).__init__(section, config)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
|
|
@ -3,7 +3,7 @@ import plugins.common
|
||||||
|
|
||||||
|
|
||||||
class PluginThread(plugins.common.PluginThreadCommon):
|
class PluginThread(plugins.common.PluginThreadCommon):
|
||||||
def __init__(self, section, config, thread_id):
|
def __init__(self, section, config):
|
||||||
super(PluginThread, self).__init__(section, config)
|
super(PluginThread, self).__init__(section, config)
|
||||||
self.date_format = config.get(section, 'format', fallback='%c')
|
self.date_format = config.get(section, 'format', fallback='%c')
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import psutil
|
||||||
|
|
||||||
|
|
||||||
class PluginThread(plugins.common.PluginThreadCommon):
|
class PluginThread(plugins.common.PluginThreadCommon):
|
||||||
def __init__(self, section, config, thread_id):
|
def __init__(self, section, config):
|
||||||
super(PluginThread, self).__init__(section, config)
|
super(PluginThread, self).__init__(section, config)
|
||||||
self.part = config.get(section, 'part')
|
self.part = config.get(section, 'part')
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import plugins.common
|
||||||
|
|
||||||
|
|
||||||
class PluginThread(plugins.common.PluginThreadCommon):
|
class PluginThread(plugins.common.PluginThreadCommon):
|
||||||
def __init__(self, section, config, thread_id):
|
def __init__(self, section, config):
|
||||||
super(PluginThread, self).__init__(section, config)
|
super(PluginThread, self).__init__(section, config)
|
||||||
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=False)
|
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=False)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import plugins.common
|
||||||
|
|
||||||
|
|
||||||
class PluginThread(plugins.common.PluginThreadCommon):
|
class PluginThread(plugins.common.PluginThreadCommon):
|
||||||
def __init__(self, section, config, thread_id):
|
def __init__(self, section, config):
|
||||||
super(PluginThread, self).__init__(section, config)
|
super(PluginThread, self).__init__(section, config)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import plugins.common
|
||||||
|
|
||||||
|
|
||||||
class PluginThread(plugins.common.PluginThreadCommon):
|
class PluginThread(plugins.common.PluginThreadCommon):
|
||||||
def __init__(self, section, config, thread_id):
|
def __init__(self, section, config):
|
||||||
super(PluginThread, self).__init__(section, config)
|
super(PluginThread, self).__init__(section, config)
|
||||||
self.hosts = config.get(section, 'hosts').split(',')
|
self.hosts = config.get(section, 'hosts').split(',')
|
||||||
self.title = config.get(section, 'title')
|
self.title = config.get(section, 'title')
|
||||||
|
|
4
vdstatus
4
vdstatus
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# TODO: handle SIGINT properly
|
# TODO: handle SIGINT properly
|
||||||
# TODO: add documentation / comments
|
# TODO: add documentation / comments
|
||||||
# TODO: add a dummy plugin to use as a starting point
|
|
||||||
# TODO: interactivity support
|
# TODO: interactivity support
|
||||||
import argparse
|
import argparse
|
||||||
import configparser
|
import configparser
|
||||||
|
@ -36,9 +35,8 @@ class PluginRunner:
|
||||||
self.format_output = self.format_term
|
self.format_output = self.format_term
|
||||||
for section in self.config.sections():
|
for section in self.config.sections():
|
||||||
plugin_name = self.config.get(section, 'plugin')
|
plugin_name = self.config.get(section, 'plugin')
|
||||||
plugin_id = len(self.plugins_loaded)
|
|
||||||
module = importlib.import_module('.' + plugin_name, 'plugins')
|
module = importlib.import_module('.' + plugin_name, 'plugins')
|
||||||
thread_object = module.PluginThread(section, self.config, plugin_id)
|
thread_object = module.PluginThread(section, self.config)
|
||||||
self.plugins_loaded.append(thread_object)
|
self.plugins_loaded.append(thread_object)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
Loading…
Reference in a new issue