watching new installed plugins for loading ahenk is disabled until watchdog dependency is added to repo

This commit is contained in:
Volkan Şahin 2016-07-19 16:04:46 +03:00
parent cc113eb664
commit f805748009

View file

@ -34,7 +34,7 @@ class PluginManager(object):
self.plugins = [] self.plugins = []
self.pluginQueueDict = dict() self.pluginQueueDict = dict()
self.listener = self.install_listener() # self.listener = self.install_listener()
self.delayed_profiles = {} self.delayed_profiles = {}
self.delayed_tasks = {} self.delayed_tasks = {}
@ -86,9 +86,8 @@ class PluginManager(object):
def reload_plugins(self): def reload_plugins(self):
try: try:
self.logger.info('[PluginManager] Reloading plugins...') self.logger.info('[PluginManager] Reloading plugins...')
kill_signal = PluginKillSignal()
for p_queue in self.pluginQueueDict: for p_queue in self.pluginQueueDict:
p_queue.put(kill_signal) self.pluginQueueDict[p_queue].put(PluginKillSignal())
self.plugins = [] self.plugins = []
self.load_plugins() self.load_plugins()
self.logger.info('[PluginManager] Plugin reloaded successfully.') self.logger.info('[PluginManager] Plugin reloaded successfully.')
@ -109,13 +108,13 @@ class PluginManager(object):
try: try:
self.logger.debug('[PluginManager] Removing all plugins...') self.logger.debug('[PluginManager] Removing all plugins...')
for p_queue in self.pluginQueueDict: for p_queue in self.pluginQueueDict:
p_queue.put(PluginKillSignal()) self.pluginQueueDict[p_queue].put(PluginKillSignal())
# todo check is running # todo check is running
self.plugins = [] self.plugins = []
self.pluginQueueDict = dict() self.pluginQueueDict = dict()
self.logger.debug('[PluginManager] All plugins were removed successfully.') self.logger.debug('[PluginManager] All plugins were removed successfully.')
except Exception as e: except Exception as e:
self.logger.debug('[PluginManager] A problem occurred while removing plugins. Error Message :{0}.'.format(str(e))) self.logger.error('[PluginManager] A problem occurred while removing plugins. Error Message :{0}.'.format(str(e)))
def remove_single_plugin(self, plugin_name): def remove_single_plugin(self, plugin_name):
try: try:
@ -269,11 +268,13 @@ class PluginManager(object):
self.logger.warning('[PluginManager] safe.py not found Plugin Name : ' + str(plugin_name)) self.logger.warning('[PluginManager] safe.py not found Plugin Name : ' + str(plugin_name))
return None return None
"""
def install_listener(self): def install_listener(self):
listener = PluginInstallListener() listener = PluginInstallListener()
thread = Process(target=listener.listen, args=(System.Ahenk.plugins_path(),)) thread = Process(target=listener.listen, args=(System.Ahenk.plugins_path(),))
thread.start() thread.start()
return thread return thread
"""
def is_plugin_loaded(self, plugin_name): def is_plugin_loaded(self, plugin_name):
try: try: