Skip to content

Commit

Permalink
feature: Job 对接审计中心 TencentBlueKing#1765
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Sep 18, 2023
1 parent 6c01c6e commit 3c74d36
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public void schedule() {
findStatisticsTask();
}
//根据任务各自周期进行调度
stopWatch.start("currentAuditContext all statistic tasks time consuming");
stopWatch.start("current all statistic tasks time consuming");
//调度新线程跑分析任务
for (IStatisticsTask iStatisticsTask : statisticsTaskList) {
String taskName =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void run() {
}
}
} else {
log.info("Use currentAuditContext single thread to run makeup tasks");
log.info("Use current single thread to run makeup tasks");
for (WatchableTask<Boolean> callable : callableList) {
try {
pastStatisticTaskFutureMap.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public ThreadPoolExecutor localFilePrepareExecutor(LocalFileConfigForExecute loc
//使用请求的线程直接拉取数据
log.error(
"download localupload file from artifactory runnable rejected," +
" use currentAuditContext thread({}), plz add more threads",
" use current thread({}), plz add more threads",
Thread.currentThread().getName());
r.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ private void skipStep(StepInstanceDTO stepInstance) {

TaskInstanceDTO taskInstance = taskInstanceService.getTaskInstance(stepInstance.getTaskInstanceId());
if (!(taskInstance.getCurrentStepInstanceId() == stepInstanceId)) {
log.warn("Only currentAuditContext running step is support for skipping, stepInstanceId={}", stepInstanceId);
log.warn("Only current running step is support for skipping, stepInstanceId={}", stepInstanceId);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ public Response<Boolean> checkAlias(String username,

@Override
@AuditEntry(actionId = ActionId.CREATE_FILE_SOURCE)
public Response<FileSourceVO> saveFileSource(String username,
AppResourceScope appResourceScope,
String scopeType,
String scopeId,
@AuditRequestBody FileSourceCreateUpdateReq fileSourceCreateUpdateReq) {
public Response<FileSourceVO> saveFileSource(
String username,
AppResourceScope appResourceScope,
String scopeType,
String scopeId,
@AuditRequestBody FileSourceCreateUpdateReq fileSourceCreateUpdateReq) {
try {
Long appId = appResourceScope.getAppId();
checkParam(appId, fileSourceCreateUpdateReq, true);
Expand All @@ -150,11 +151,12 @@ public Response<FileSourceVO> saveFileSource(String username,

@Override
@AuditEntry(actionId = ActionId.MANAGE_FILE_SOURCE)
public Response<FileSourceVO> updateFileSource(String username,
AppResourceScope appResourceScope,
String scopeType,
String scopeId,
@AuditRequestBody FileSourceCreateUpdateReq fileSourceCreateUpdateReq) {
public Response<FileSourceVO> updateFileSource(
String username,
AppResourceScope appResourceScope,
String scopeType,
String scopeId,
@AuditRequestBody FileSourceCreateUpdateReq fileSourceCreateUpdateReq) {
Long appId = appResourceScope.getAppId();
log.info("Input=({},{},{})", username, appId, fileSourceCreateUpdateReq);
FileSourceDTO fileSourceDTO = buildFileSourceDTO(username, appId, fileSourceCreateUpdateReq);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void updateTagById() {
assertThat(result.getDescription()).isEqualTo(updateTag.getDescription());


// Tag not exist in currentAuditContext application
// Tag not exist in current application
updateTag.setAppId(1L);
assertThat(tagDAO.updateTagById(updateTag)).isFalse();
// Tag Not exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ private void processTopologyNodeName(
if (nodeTypeNameMap == null) {
throw new RuntimeException("Uninitialized node type name map!");
}
// Check and init node name map for currentAuditContext type
// Check and init node name map for current type
Map<Long, String> nodeNameMap = nodeTypeNameMap.get(topology.getObjectId());
if (nodeNameMap == null) {
nodeNameMap = new ConcurrentHashMap<>(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public AccountDTO createAccount(AccountDTO account) throws ServiceException {
throw new NotFoundException(ErrorCode.DB_SYSTEM_ACCOUNT_IS_INVALID);
}
if (!dbSystemAccount.getAppId().equals(account.getAppId())) {
log.warn("DB related system account is not in currentAuditContext app, systemAccountId={}, " +
log.warn("DB related system account is not in current app, systemAccountId={}, " +
"systemAccountAppId={}"
, account.getDbSystemAccountId(), dbSystemAccount.getAppId());
throw new NotFoundException(ErrorCode.DB_SYSTEM_ACCOUNT_IS_INVALID);
Expand Down Expand Up @@ -235,7 +235,8 @@ public AccountDTO updateAccount(String username, AccountDTO updateAccount) throw
if (StringUtils.isNotEmpty(updateAccount.getPassword())) {
updateAccount.setPassword(encryptor.encrypt(updateAccount.getPassword()));
}
if (updateAccount.getCategory() == AccountCategoryEnum.DB && StringUtils.isNotEmpty(updateAccount.getDbPassword())) {
if (updateAccount.getCategory() == AccountCategoryEnum.DB
&& StringUtils.isNotEmpty(updateAccount.getDbPassword())) {
updateAccount.setDbPassword(encryptor.encrypt(updateAccount.getPassword()));
}
// 账号用途、账号类型、账号名称不允许修改
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public DangerousRuleDTO getDangerousRuleById(Long id) {
public DangerousRuleDTO createDangerousRule(String username, AddOrUpdateDangerousRuleReq req) {
int scriptType = DangerousRuleDTO.encodeScriptType(req.getScriptTypeList());
int maxPriority = dangerousRuleDAO.getMaxPriority();
log.info(String.format("currentAuditContext maxPriority:%d", maxPriority));
log.info(String.format("current maxPriority:%d", maxPriority));
long id = dangerousRuleDAO.insertDangerousRule(new DangerousRuleDTO(null, req.getExpression(),
req.getDescription(), maxPriority + 1, scriptType, username, System.currentTimeMillis(), username,
System.currentTimeMillis(), req.getAction(), EnableStatusEnum.DISABLED.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public void publishScript(Long appId,
ScriptDTO scriptVersionToBePublished = null;
for (ScriptDTO scriptVersion : scriptVersions) {
if (!isPublicScript && !scriptVersion.getAppId().equals(targetAppId)) {
log.warn("Publish script, script:{} is not in currentAuditContext app:{}", scriptId, targetAppId);
log.warn("Publish script, script:{} is not in current app:{}", scriptId, targetAppId);
throw new NotFoundException(ErrorCode.SCRIPT_NOT_IN_APP);
}
if (scriptVersion.getScriptVersionId().equals(scriptVersionId)) {
Expand Down Expand Up @@ -616,7 +616,7 @@ public void disableScript(Long appId,
ScriptDTO scriptVersionToBeDisabled = null;
for (ScriptDTO scriptVersion : scriptVersions) {
if (!scriptVersion.getAppId().equals(targetAppId)) {
log.warn("Disable script, script:{} is not in currentAuditContext app:{}", scriptId, targetAppId);
log.warn("Disable script, script:{} is not in current app:{}", scriptId, targetAppId);
throw new NotFoundException(ErrorCode.SCRIPT_NOT_IN_APP);
}
if (scriptVersion.getScriptVersionId().equals(scriptVersionId)) {
Expand Down Expand Up @@ -668,7 +668,7 @@ private void checkScriptInApp(long appId, ScriptDTO script) {
}
if (!script.isPublicScript()) {
if (!script.getAppId().equals(appId)) {
log.warn("Script:{} is not in currentAuditContext app:{}", script.getId(), appId);
log.warn("Script:{} is not in current app:{}", script.getId(), appId);
throw new NotFoundException(ErrorCode.SCRIPT_NOT_IN_APP);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public void processTemplateStep(TaskTemplateInfoDTO taskTemplateInfo) {
taskStepService.deleteStepById(taskStep.getTemplateId(), taskStep.getId());
stepIterator.remove();
} else {
// Update previous step info on currentAuditContext step
// Update previous step info on current step
if (previousStep == null) {
taskStep.setPreviousStepId(0L);
} else {
Expand All @@ -851,13 +851,13 @@ public void processTemplateStep(TaskTemplateInfoDTO taskTemplateInfo) {
taskStep.setId(taskStepService.insertStep(taskStep));
}

// update previous step to point to currentAuditContext step
// update previous step to point to current step
if (previousStep != null) {
previousStep.setNextStepId(taskStep.getId());
taskStepService.updateStepById(previousStep);
}

// make previous currentAuditContext
// make previous current
previousStep = taskStep;
if (firstStepId == 0) {
firstStepId = taskStep.getId();
Expand Down

0 comments on commit 3c74d36

Please sign in to comment.