def get(self, projectid): result = None try: result = super(RoleManager, self).get_queryset().get(id=projectid) except Exception as ex: SimpleLogger.exception(ex) return result
def download_package(request,file_id): try: file=FileInfo.objects.get(int(file_id)) contents=FileInfoService.download_file(file_id) def file_iterator(chunk_size=1024*50): while True: c = contents.read(chunk_size) if c: yield c else: break result=StreamingHttpResponse(file_iterator(), content_type='application/octet-stream') display_file_name=str(file.FileName.encode("utf-8")).replace("'","") result['Content-Disposition'] = 'attachment;filename="'+display_file_name+'"' except Exception as ex: result=HttpResponse(str(ex)) SimpleLogger.exception(ex) return result
def history_clean_worker(task_historys): for history in task_historys: try: if history.PackageID: for fileid in eval(history.PackageID): FileInfoService.delete_file(fileid) CITaskHistoryService.clean_temp_file(fileid) if history.LogFileID: for fileid in eval(history.LogFileID): FileInfoService.delete_file(fileid) CITaskHistoryService.clean_temp_file(fileid) if history.BuildLogID: FileInfoService.delete_file(history.BuildLogID, mongo_model=BuildLogMongoFile) history.BuildLogID = 0 if history.ChangeLog: PackgeMongoFile.objects.delete_value(history.ChangeLog) history.IsActive = 0 except Exception as ex: SimpleLogger.exception(ex) history.IsActive = 1 continue finally: history.save()
def project_taskflows(self, project_id): result = None try: result = self.all().filter(Project=project_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_user(userid): user = None try: user = User.objects.get(id=userid) except Exception as ex: SimpleLogger.exception(ex) return user
def get_history_by_tq(self, tq_id): result = list() try: result = self.all().filter(TaskQueueID=tq_id) except Exception as ex: SimpleLogger.exception(ex) return result[0]
def get(self, case_id): result = None try: result = self.all().get(id=case_id) except Exception as ex: SimpleLogger.exception(ex) return result
def user_issue_filter(self, user_id): result = None try: result = self.all().filter(Creator=user_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_versions(self, project_id): result = list() try: result = self.all().filter(VProjectID=project_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_version_issue_statistics(self, version_id): result = None try: result = self.all().filter(VersionID=version_id) except Exception as ex: SimpleLogger.exception(ex) return result
def issue_activity(self, issue_id): result = None try: result = self.all().filter(Issue=issue_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_project_issue_statistics(self, projectid): result = None try: result = self.all().filter(ProjectID=projectid) except Exception as ex: SimpleLogger.exception(ex) return result
def get_reporter_issue(self, reporter_id): result = None try: result = self.all().filter(Creator=reporter_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_processor_issue(self, processor_id): result = None try: result = self.all().filter(Processor=processor_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_by_tqid(self, tq_id): result = None try: result = self.all().filter(TaskQueueID=tq_id)[0] except Exception as ex: SimpleLogger.exception(ex) return result
def project_fortestings(self, project_id): result = list() try: result = self.all().filter(ProjectID=project_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_task_history(self, task_id, is_active=1): result = None try: result = self.all(is_active).filter(CITaskID=task_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get(self, file_id): result = None try: result = super(FileManager, self).get_queryset().get(id=file_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_history_by_uuid(self, uuid): result = list() try: result = self.all().filter(TaskUUID=uuid) except Exception as ex: SimpleLogger.exception(ex) return result[0]
def get(self, error_code): result = None try: result = self.all().filter(ErrorCode=error_code)[0] except Exception as ex: SimpleLogger.exception(ex) return result
def get(self, task_id): result = None try: result = super(CITaskManager, self).get_queryset().get(id=task_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get(self, app_id): result = None try: result = super(WebappManager, self).get_queryset().get(id=app_id) except Exception as ex: SimpleLogger.exception(ex) return result
def flow_sections(self, flow_id): result = None try: result = self.all().filter(TaskFlow=flow_id) except Exception as ex: SimpleLogger.exception(ex) return result
def get_by_ip(self, agent_ip): result = None try: result = super(AgentManager, self).get_queryset().get(IP=agent_ip) except Exception as ex: SimpleLogger.exception(ex) return result
def stop_task(request,task_id): result="Flase" try: result=CITaskService.stop_ci_task(request,task_id) except Exception as ex: SimpleLogger.exception(ex) return HttpResponse(result)
def get_bslogs_by_deviceid(device_id): result = list() try: result = BusinessLog.objects.all().filter(deviceId=device_id) except Exception as ex: SimpleLogger.exception(ex) return result
def index_list(request, sub_nav_action): ''' index page''' try: page_worker = CIBuildPageWorker(request) except Exception as ex: SimpleLogger.exception(ex) return page_worker.get_build_fullpage(request, sub_nav_action)
def change_logs(self): result = list() try: change_logs = CITaskHistoryService.get_change_log( self.ci_task_history.ChangeLog) json_decoder = JSONDecoder() if change_logs: all_resp_changes = json_decoder.decode( change_logs['change_log']) index = 1 for resp_changes in all_resp_changes: repo = resp_changes['repo'] for changes in resp_changes['changes']: temp_changelog = VM_CITaskChangeLog( changes, index, repo) result.append(temp_changelog) index = index + 1 elif self.ci_task_history.CodeVersion: all_changes = json_decoder.decode( self.ci_task_history.CodeVersion) temp_changelog = VM_CITaskChangeLog(all_changes[0], 0, "") result.append(temp_changelog) except Exception as ex: SimpleLogger.exception(ex) return result
def copy_package(history): ''' copy release package to release resp ''' result = list() if history.PackageID and not CITaskHistoryService.is_history_archived( history): history_files = list() new_archive = CITaskHistoryService.new_archive( history, history_files) for old_file_id in eval(history.PackageID): file_id = 0 try: file_id = FileInfoService.copy_file( old_file_id, PackgeMongoFile, ReleaseArchiveMongoFile) result.append(file_id) history_files.append(file_id) except Exception as ex: FileInfoService.delete_file(file_id, ReleaseArchiveMongoFile) new_archive.delete() SimpleLogger.exception(ex) result = None if result: file_ids = "" for file_id in history_files: file_ids = file_ids + str(file_id) + "," new_archive.Archives = file_ids new_archive.save() return result
def get_member(self, projectid, userid): result = None try: result = self.get_members(projectid).filter(PMMember=userid)[0] except Exception as ex: SimpleLogger.exception(ex) return result