Skip to content

Commit

Permalink
[INLONG-11402][Manager] Download the installer to a temporary directo…
Browse files Browse the repository at this point in the history
…ry (#11403)
  • Loading branch information
fuweng11 authored Oct 24, 2024
1 parent d62932d commit 23b148e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ public boolean install(ClusterNodeRequest clusterNodeRequest, String operator) {
clusterNodeEntityMapper.updateOperateLogById(clusterNodeRequest.getId(), NodeStatus.INSTALLING.getStatus(),
currentTime + InlongConstants.BLANK + "begin to install");
AgentClusterNodeRequest request = (AgentClusterNodeRequest) clusterNodeRequest;
commandExecutor.mkdir(request, agentInstallTempPath);
String downLoadUrl = getInstallerDownLoadUrl(request);
commandExecutor.downLoadPackage(request, agentInstallTempPath, downLoadUrl);

deployInstaller(request, operator);
String startCmd = agentInstallPath + INSTALLER_START_CMD;
commandExecutor.execRemote(request, startCmd);
Expand Down Expand Up @@ -137,7 +141,8 @@ public boolean reInstall(ClusterNodeRequest clusterNodeRequest, String operator)
commandExecutor.rmDir(request, agentInstallTempPath);
commandExecutor.mkdir(request, agentInstallTempPath);
commandExecutor.cpDir(request, agentInstallPath + "/conf/modules.json", agentInstallTempPath);

String downLoadUrl = getInstallerDownLoadUrl(request);
commandExecutor.downLoadPackage(request, agentInstallTempPath, downLoadUrl);
commandExecutor.rmDir(request, agentInstallPath.substring(0, agentInstallPath.lastIndexOf(File.separator)));
deployInstaller(request, operator);

Expand Down Expand Up @@ -201,8 +206,7 @@ private void deployInstaller(AgentClusterNodeRequest request, String operator) t
commandExecutor.mkdir(request, agentInstallPath);
String downLoadUrl = getInstallerDownLoadUrl(request);
String fileName = downLoadUrl.substring(downLoadUrl.lastIndexOf('/') + 1);
commandExecutor.downLoadPackage(request, agentInstallPath, downLoadUrl);
commandExecutor.tarPackage(request, fileName, agentInstallPath);
commandExecutor.tarPackage(request, fileName, agentInstallTempPath, agentInstallPath);
String confFile = agentInstallPath + INSTALLER_CONF_PATH;
Map<String, String> configMap = new HashMap<>();
configMap.put(AGENT_LOCAL_IP, request.getIp());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public interface CommandExecutor {
CommandResult modifyConfig(AgentClusterNodeRequest clusterNodeRequest, Map<String, String> configMap,
String confPath) throws Exception;

CommandResult tarPackage(AgentClusterNodeRequest clusterNodeRequest, String fileName, String tarPath)
throws Exception;
CommandResult tarPackage(AgentClusterNodeRequest clusterNodeRequest, String fileName, String sourcePath,
String tarPath) throws Exception;

CommandResult downLoadPackage(AgentClusterNodeRequest clusterNodeRequest, String downLoadPath, String downLoadUrl)
throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public CommandResult modifyConfig(AgentClusterNodeRequest clusterNodeRequest, Ma
}

@Override
public CommandResult tarPackage(AgentClusterNodeRequest clusterNodeRequest, String fileName,
public CommandResult tarPackage(AgentClusterNodeRequest clusterNodeRequest, String fileName, String sourcePath,
String tarPath) throws Exception {
String tarCmd = "tar -zxvf " + tarPath + fileName + " -C " + tarPath;
String tarCmd = "tar -zxvf " + sourcePath + fileName + " -C " + tarPath;
return execRemote(clusterNodeRequest, tarCmd);
}

Expand Down

0 comments on commit 23b148e

Please sign in to comment.