Ejemplo n.º 1
0
    def install(self, id, load=True):
        """
        Installs a plugin

        :param  id:     Plugin id
        :type   id:     str
        :param  load:   True if you want Ajenti to load the plugin immediately
        :type   load:   bool
        """
        from ajenti import generation, version
        dir = self.config.get('ajenti', 'plugins')

        download('http://%s/plugins/%i/%s/plugin.tar.gz' % (self.server, generation, id),
            file='%s/plugin.tar.gz'%dir, crit=True)

        self.remove(id)
        self.install_tar(load=load)
Ejemplo n.º 2
0
 def update_list(self):
     """
     Downloads fresh list of plugins and rebuilds installed/available lists
     """
     from ajenti import generation, version
     if not os.path.exists('/var/lib/ajenti'):
         os.mkdir('/var/lib/ajenti')
     send_stats(self.server, PluginLoader.list_plugins().keys())
     data = download('http://%s/api/plugins?pl=%s&gen=%i' % (self.server,detect_platform(),generation))
     try:
         open('/var/lib/ajenti/plugins.list', 'w').write(data)
     except:
         pass
     self.update_installed()
     self.update_available()
     self.update_upgradable()