use of io.jpom.model.data.NodeModel in project Jpom by dromara.
the class WorkspaceEnvVarController method syncDelNodeEnvVar.
private void syncDelNodeEnvVar(String name, UserModel user, Collection<String> delNode, String workspaceId) {
for (String s : delNode) {
NodeModel byKey = nodeService.getByKey(s);
Assert.state(StrUtil.equals(workspaceId, byKey.getWorkspaceId()), "选择节点错误");
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", name);
JsonMessage<String> jsonMessage = NodeForward.request(byKey, NodeUrl.Workspace_EnvVar_Delete, user, jsonObject);
Assert.state(jsonMessage.getCode() == 200, "处理 " + byKey.getName() + " 节点删除脚本失败" + jsonMessage.getMsg());
}
}
use of io.jpom.model.data.NodeModel in project Jpom by dromara.
the class NodeInfoController method createModel.
private NodeModel createModel(String ip, String loginName, String loginPwd, int port, String workspaceId) {
NodeModel nodeModel = new NodeModel();
nodeModel.setWorkspaceId(workspaceId);
nodeModel.setName(ip);
nodeModel.setOpenStatus(1);
nodeModel.setLoginName(loginName);
nodeModel.setLoginPwd(loginPwd);
nodeModel.setUrl(ip + StrUtil.COLON + port);
nodeModel.setProtocol("http");
return nodeModel;
}
use of io.jpom.model.data.NodeModel in project Jpom by dromara.
the class ReleaseManage method doProject.
/**
* 发布项目
*/
private void doProject() {
// AfterOpt afterOpt, boolean clearOld, boolean diffSync
AfterOpt afterOpt = BaseEnum.getEnum(AfterOpt.class, this.buildExtraModule.getAfterOpt(), AfterOpt.No);
boolean clearOld = this.buildExtraModule.isClearOld();
boolean diffSync = this.buildExtraModule.isDiffSync();
String releaseMethodDataId = this.buildExtraModule.getReleaseMethodDataId();
String[] strings = StrUtil.splitToArray(releaseMethodDataId, CharPool.COLON);
if (ArrayUtil.length(strings) != 2) {
throw new IllegalArgumentException(releaseMethodDataId + " error");
}
NodeService nodeService = SpringUtil.getBean(NodeService.class);
NodeModel nodeModel = nodeService.getByKey(strings[0]);
Objects.requireNonNull(nodeModel, "节点不存在");
String projectId = strings[1];
if (diffSync) {
this.diffSyncProject(nodeModel, projectId, afterOpt, clearOld);
return;
}
File zipFile = BuildUtil.isDirPackage(this.resultFile);
boolean unZip = true;
if (zipFile == null) {
zipFile = this.resultFile;
unZip = false;
}
JsonMessage<String> jsonMessage = OutGivingRun.fileUpload(zipFile, null, projectId, unZip, afterOpt, nodeModel, this.userModel, clearOld);
if (jsonMessage.getCode() == HttpStatus.HTTP_OK) {
logRecorder.info("发布项目包成功:" + jsonMessage);
} else {
throw new JpomRuntimeException("发布项目包失败:" + jsonMessage);
}
}
use of io.jpom.model.data.NodeModel in project Jpom by dromara.
the class BaseServerController method getNode.
protected NodeModel getNode() {
NodeModel nodeModel = tryGetNode();
Assert.notNull(nodeModel, "节点信息不正确,对应对节点不存在");
return nodeModel;
}
use of io.jpom.model.data.NodeModel in project Jpom by dromara.
the class PermissionInterceptor method addNode.
private void addNode(HttpServletRequest request) {
String nodeId = request.getParameter("nodeId");
if (!StrUtil.isBlankOrUndefined(nodeId)) {
// 节点信息
NodeModel nodeModel = nodeService.getByKey(nodeId);
if (nodeModel != null && !nodeModel.isOpenStatus()) {
throw new AgentException(nodeModel.getName() + "节点未启用");
}
request.setAttribute("node", nodeModel);
}
}
Aggregations