示例#1
0
 def get_bridges_files(self, standalone):
     content = []
     if not standalone:
         if self.client:
            self.client.send_json(rfc.create_request('get_bridges_files', None))
            res = self.client.recv_json()
            if res and res['success']:
                for key in res['result']:
                    if not res['result'][key].has_key('error'):
                        content.extend(res['result'][key]['content'])
         return files
     else:
         # if standalone no Slave but make use of slave static functions
         return open(Slave.bridges_files(), 'r')
示例#2
0
文件: host.py 项目: renardal/pyjeet
 def get_bridges_files(self, standalone):
     files = []
     if not standalone:
        pass
        # if self.client:
        #     self.client.send_json(rfc.create_request('get_bridges_files', None))
        #     res = self.client.recv_json()
        #     if res and res['success']:
        #         for key in res['result']:
        #             if not res['result'][key].has_key('error'):
        #                 files.append({'name': key, 'content': res['result'][key]['content']})
        # return files
     else:
         #if standalone no Slave but make use of slave static functions
         # /!\ for now only use brctl conf file without creating file object nor normalizing
         # might need to change this later to generalize
         #for bridge_file in Slave.bridges_files():
         #    files.append({'name': bridge_file, 'content': open(bridge_file, 'r')})
         return open(Slave.bridges_files(), 'r')