def perform_update(self, serializer): instance = serializer.save() version_str = '' if instance.version: version_str = ''.join(["==", instance.version]) pip.main(['install', 'lisa-plugins-' + instance.name + version_str]) logger.info(msg="Plugin updated")
def load_plugins(self): self.mgr = extension.ExtensionManager(namespace='lisa.api.plugins', invoke_on_load=True, verify_requirements=True) self.plugins = self.mgr.names() for plugin in self.plugins: self.django_plugins.append('lisa_plugins_%s' % plugin) logger.info("Loaded plugins : %s" % self.plugins)
def perform_create(self, serializer): instance = serializer.save() version_str = '' if instance.version: version_str = ''.join(["==", instance.version]) pip.main(['install', 'lisa-plugins-' + instance.name + version_str]) if settings.BASE_DIR: self._touch(fname='/'.join([settings.BASE_DIR, '__init__.py'])) logger.info(msg="Plugin installed")
def load_plugins(self): self.mgr = extension.ExtensionManager( namespace='lisa.api.plugins', invoke_on_load=True, verify_requirements=True ) self.plugins = self.mgr.names() for plugin in self.plugins: self.django_plugins.append('lisa_plugins_%s' % plugin) logger.info("Loaded plugins : %s" % self.plugins)
def get_version(self, plugin_name): if self.plugins: try: version = self.mgr.map(lambda ext: (ext.name, ext.obj.get_version())) for plugin in version: if plugin_name == plugin[0]: return plugin[1] except RuntimeError: logger.info("There was a problem loading plugins") else: logger.info("There is no plugin loaded")
def load_intents(self): if self.plugins: logger.info("Adding intents to database") try: self.mgr.map(lambda ext: (ext.name, ext.obj.add_intents())) except RuntimeError: logger.info("There was a problem loading plugins intents") else: logger.info("There is no plugin loaded")
def perform_destroy(self, instance): pip.main(['uninstall', '--yes', 'lisa-plugins-' + instance.name]) instance.delete() if settings.BASE_DIR: self._touch(fname='/'.join([settings.BASE_DIR, '__init__.py'])) logger.info(msg="Delete plugin")