fix: ASW-176 job 支持 playbook param 参数
This commit is contained in:
@@ -140,6 +140,10 @@ public class JobPlaybookExecutor extends QuartzJobBean {
|
||||
.set(JobEntity::getEndTimestamp, System.currentTimeMillis())
|
||||
.eq(JobEntity::getId, job.getId()));
|
||||
}
|
||||
|
||||
// remove session
|
||||
environmentService.removeSession(session.getId());
|
||||
log.info("[playbookExecutor] [request env exec playbook error] [job id: {}]", job.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -154,7 +158,15 @@ public class JobPlaybookExecutor extends QuartzJobBean {
|
||||
PackageEntity packageEntity = packageService.getById(packageId);
|
||||
File packageFile = T.FileUtil.file(packageEntity.getPath());
|
||||
String packageName = packageEntity.getIdentifier();
|
||||
|
||||
String playbookParam = job.getPlaybookParam();
|
||||
Map<String, Object> params = T.MapUtil.newHashMap();
|
||||
if (T.StrUtil.isNotEmpty(playbookParam)) {
|
||||
params = T.JSONUtil.toBean(playbookParam, Map.class);
|
||||
}else {
|
||||
params.put("reInstall", true);
|
||||
params.put("clearCache", true);
|
||||
params.put("unInstall", true);
|
||||
}
|
||||
PlaybookEntity playbook = playbookService.getById(playbookId);
|
||||
File playbookFile = T.FileUtil.file(playbook.getPath());
|
||||
|
||||
@@ -170,7 +182,9 @@ public class JobPlaybookExecutor extends QuartzJobBean {
|
||||
request.form("id", job.getId());
|
||||
request.form("packageName", packageName);
|
||||
request.header("Authorization", token);
|
||||
|
||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||
request.form(param.getKey(), param.getValue());
|
||||
}
|
||||
HttpResponse response = request.execute();
|
||||
return response;
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user