示例#1
0
文件: plugmgr.py 项目: ardnet/genesis
    def install(self, id, load=True, cat=''):
        """
        Installs a plugin

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

        if cat:
            cat.statusmsg('Downloading plugin package...')
        data = send_json('https://%s/' % self.server, {
            'get': 'plugin',
            'id': id
        },
                         crit=True)
        if data['status'] == 200:
            open('%s/plugin.tar.gz' % dir,
                 'wb').write(base64.b64decode(data['info']))
        else:
            self.log.error('Plugin retrieval failed - %s' % str(data['info']))
            raise Exception('Plugin retrieval failed - %s' % str(data['info']))

        #self.remove(id)
        self.install_tar(load=load, cat=cat)
示例#2
0
 def update_list(self, crit=False):
     """
     Downloads fresh list of plugins and rebuilds installed/available lists
     """
     from genesis import generation, version
     if not os.path.exists('/var/lib/genesis'):
         os.mkdir('/var/lib/genesis')
     try:
         data = send_json('https://%s/' % self.server, 
             {'get': 'list', 'distro': PluginLoader.platform}, 
             returns='raw', crit=True)
         open('/var/lib/genesis/plugins.list', 'w').write(data)
     except IOError, e:
         self.log.error('Failed to write application list to disk.')
示例#3
0
文件: root.py 项目: ardnet/genesis
 def handle_errorrpt(self, req, sr):
     url = self.app.config.get('genesis', 'update_server', 'grm.arkos.io')
     try:
         rpt = json.loads(req['wsgi.input'].read())
         data = send_json('https://%s/' % url, 
             {'put': 'crashreport', 'report': rpt['report'], 'comments': rpt['comments']}, crit=True)
         if data['status'] == 200:
             self.app.log.info('An automatic error report was filed to %s' % url)
             return json.dumps({"status": 200})
         else:
             self.app.log.error('Automatic error report filing failed: An unspecified server error occurred, please contact arkOS maintainers')
             return json.dumps({"status": 500})
     except Exception, e:
         self.app.log.error('Automatic error report filing failed: %s' % str(e))
         return json.dumps({"status": 500})
示例#4
0
文件: plugmgr.py 项目: ardnet/genesis
 def update_list(self, crit=False):
     """
     Downloads fresh list of plugins and rebuilds installed/available lists
     """
     from genesis import generation, version
     if not os.path.exists('/var/lib/genesis'):
         os.mkdir('/var/lib/genesis')
     try:
         data = send_json('https://%s/' % self.server, {
             'get': 'list',
             'distro': PluginLoader.platform
         },
                          returns='raw',
                          crit=True)
         open('/var/lib/genesis/plugins.list', 'w').write(data)
     except IOError, e:
         self.log.error('Failed to write application list to disk.')
示例#5
0
    def install(self, id, load=True, cat=''):
        """
        Installs a plugin

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

        if cat:
            cat.statusmsg('Downloading plugin package...')
        data = send_json('https://%s/' % self.server, 
            {'get': 'plugin', 'id': id}, crit=True)
        if data['status'] == 200:
            open('%s/plugin.tar.gz'%dir, 'wb').write(base64.b64decode(data['info']))
        else:
            self.log.error('Plugin retrieval failed - %s' % str(data['info']))
            raise Exception('Plugin retrieval failed - %s' % str(data['info']))

        #self.remove(id)
        self.install_tar(load=load, cat=cat)