安装集群broker时,检测目录已存在
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 285
- PR merge metrics
- No merged PRs in 30d
Description
我提前创建了 /opt/mq-cloud,卡住了,一致提示我目录已存在,我就把,return result上面三行给注释了 ,当前系统版本Centos8.2
/**
* 判断目录是否被占用
* @param ip
* @return
*/
public Result dirWrite(String ip, String dir){
String destDir = MQ_CLOUD_DIR + dir;
String comm = "if [ ! -d \"" +destDir+ "\" ];then mkdir -p " + destDir +";else echo 0;fi";
SSHResult sshResult = null;
try {
sshResult = sshTemplate.execute(ip, new SSHCallback() {
public SSHResult call(SSHSession session) {
SSHResult sshResult = session.executeCommand(comm);
return sshResult;
}
});
} catch (SSHException e) {
logger.error("isNotUsed, ip:{},dir:{}", ip, destDir, e);
return Result.getWebErrorResult(e);
}
Result result = wrapSSHResult(sshResult);
if(result.isOK() && "0".equals(result.getResult())) {
return Result.getResult(Status.DB_ERROR).setMessage("目录已存在");
}
return result;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the dirWrite(String ip, String dir) entry point and inspect how its shell command and wrapped result are used during broker installation. Reproduce the installation with an existing /opt/mq-cloud directory on CentOS 8.2, then verify the expected success behavior from the installation output; done means a pre-created directory no longer incorrectly blocks setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100