Пример #1
0
 def xmlrpc_uploadFile(self, recipe_test_id, name, size, digest, offset,
                       data):
     log.debug("XMLRPC: results.uploadFile(%r, %r, %r, %r, %r, %r)",
               recipe_test_id, name, size, digest, offset, data)
     file_id = self.get_file(name,
                             size=size,
                             digest=(digests.which_digest(digest), None))
     if file_id is None:
         msg = "%s:xmlrpc_uploadFile: " % self.__class__.__name__ + \
                 "Can not create file '%s'." % name
         self.main.error(msg)
         return msg
     if offset < 0:
         if digest:
             digest = digests.mk_digest(digest)
             if digest:
                 evt = event.file_meta(file_id, digest=digest)
                 self.main.send_evt(evt)
         evt = event.file_close(file_id)
         self.main.send_evt(evt)
         return 0
     if data:
         # FIXME: is chunk's digest necessary?
         evt = event.file_write(file_id, data, offset=offset, digest=digest)
         self.main.send_evt(evt)
     return 0  # or "Failure reason"
Пример #2
0
 def xmlrpc_uploadFile(self, recipe_test_id, name, size, digest, offset,
         data):
     log.debug("XMLRPC: results.uploadFile(%r, %r, %r, %r, %r, %r)",
             recipe_test_id, name, size, digest, offset, data)
     file_id = self.get_file(name, size=size,
             digest=(digests.which_digest(digest), None))
     if file_id is None:
         msg = "%s:xmlrpc_uploadFile: " % self.__class__.__name__ + \
                 "Can not create file '%s'." % name
         self.main.error(msg)
         return msg
     if offset < 0:
         if digest:
             digest = digests.mk_digest(digest)
             if digest:
                 evt = event.file_meta(file_id, digest=digest)
                 self.main.send_evt(evt)
         evt = event.file_close(file_id)
         self.main.send_evt(evt)
         return 0
     if data:
         # FIXME: is chunk's digest necessary?
         evt = event.file_write(file_id, data, offset=offset, digest=digest)
         self.main.send_evt(evt)
     return 0 # or "Failure reason"
Пример #3
0
 def get_file(self, pretty_name, size=None, digest=None):
     file_id = self.main.get_file(pretty_name)
     if file_id is None:
         file_id = self.main.set_file(pretty_name)
         if file_id is None:
             return None
         evt = event.file_meta(file_id, size=size, digest=digest,
                 codec="base64")
         self.main.send_evt(evt)
     return file_id
Пример #4
0
 def get_file(self, pretty_name, size=None, digest=None):
     file_id = self.main.get_file(pretty_name)
     if file_id is None:
         file_id = self.main.set_file(pretty_name)
         if file_id is None:
             return None
         evt = event.file_meta(file_id,
                               size=size,
                               digest=digest,
                               codec="base64")
         self.main.send_evt(evt)
     return file_id
Пример #5
0
 def xmlrpc_resultLog(self, log_type, result_id, pretty_name):
     log.debug("XMLRPC: results.resultLog(%r, %r, %r)", log_type, result_id,
               pretty_name)
     file_id = self.get_file(pretty_name)
     if file_id is None:
         msg = "%s:xmlrpc_resultLog: " % self.__class__.__name__ + \
                 "Can not create file '%s'." % pretty_name
         self.main.error(msg)
         return msg
     id_len = len(result_id)
     if pretty_name[:id_len] == result_id:
         pretty_name = pretty_name[id_len + 1:]
     evt = event.file_meta(file_id, name=pretty_name, handle=log_type)
     self.main.send_evt(evt)
     evt = event.relation('result_file', result_id, file_id)
     self.main.send_evt(evt)
     return 0  # or "Failure reason"
Пример #6
0
 def xmlrpc_resultLog(self, log_type, result_id, pretty_name):
     log.debug("XMLRPC: results.resultLog(%r, %r, %r)", log_type,
         result_id, pretty_name)
     file_id = self.get_file(pretty_name)
     if file_id is None:
         msg = "%s:xmlrpc_resultLog: " % self.__class__.__name__ + \
                 "Can not create file '%s'." % pretty_name
         self.main.error(msg)
         return msg
     id_len = len(result_id)
     if pretty_name[:id_len] == result_id:
         pretty_name = pretty_name[id_len+1:]
     evt = event.file_meta(file_id, name=pretty_name, handle=log_type)
     self.main.send_evt(evt)
     evt = event.relation('result_file', result_id, file_id)
     self.main.send_evt(evt)
     return 0 # or "Failure reason"