Ejemplo n.º 1
0
 def activate_plugin(self, name):
     try:
         if name in get_all_active_plugin_names():
             return "Plugin already in active list"
         if name not in get_all_plugin_names():
             return "I don't know this %s plugin" % name
         activate_plugin_by_name(name)
     except Exception as e:
         logger.exception("Error loading %s" % name)
         return '%s failed to start : %s\n' % (name, e)
     get_plugin_obj_by_name(name).callback_connect()
     return "Plugin %s activated" % name
Ejemplo n.º 2
0
 def activate_plugin(self, name):
     try:
         if name in get_all_active_plugin_names():
             return "Plugin already in active list"
         if name not in get_all_plugin_names():
             return "I don't know this %s plugin" % name
         activate_plugin_by_name(name)
     except Exception as e:
         logger.exception("Error loading %s" % name)
         return '%s failed to start : %s\n' % (name, e)
     get_plugin_obj_by_name(name).callback_connect()
     return "Plugin %s activated" % name
Ejemplo n.º 3
0
 def activate_non_started_plugins(self):
     logger.info('Activating all the plugins...')
     errors = ''
     for pluginInfo in get_all_plugins():
         try:
             if self.is_plugin_blacklisted(pluginInfo.name):
                 errors += ('Notice: %s is blacklisted, use ' + self.prefix + 'load %s to unblacklist it\n') % (
                     pluginInfo.name, pluginInfo.name)
                 continue
             if hasattr(pluginInfo, 'is_activated') and not pluginInfo.is_activated:
                 logger.info('Activate plugin: %s' % pluginInfo.name)
                 activate_plugin_by_name(pluginInfo.name)
         except Exception as e:
             logger.exception("Error loading %s" % pluginInfo.name)
             errors += 'Error: %s failed to start : %s\n' % (pluginInfo.name, e)
     if errors:
         self.warn_admins(errors)
         logger.exception(errors)
     return errors
Ejemplo n.º 4
0
 def activate_non_started_plugins(self):
     logger.info('Activating all the plugins...')
     errors = ''
     for pluginInfo in get_all_plugins():
         try:
             if self.is_plugin_blacklisted(pluginInfo.name):
                 errors += ('Notice: %s is blacklisted, use ' +
                            self.prefix + 'load %s to unblacklist it\n') % (
                                pluginInfo.name, pluginInfo.name)
                 continue
             if hasattr(pluginInfo,
                        'is_activated') and not pluginInfo.is_activated:
                 logger.info('Activate plugin: %s' % pluginInfo.name)
                 activate_plugin_by_name(pluginInfo.name)
         except Exception as e:
             logger.exception("Error loading %s" % pluginInfo.name)
             errors += 'Error: %s failed to start : %s\n' % (
                 pluginInfo.name, e)
     if errors:
         self.warn_admins(errors)
         logger.exception(errors)
     return errors