diff --git a/metadata-service-dev-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/LcmDeployToolException.java b/metadata-service-dev-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/LcmDeployToolException.java new file mode 100644 index 0000000000000000000000000000000000000000..cb465ecbb713d0fe64abec08c74a54727c4721f5 --- /dev/null +++ b/metadata-service-dev-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/LcmDeployToolException.java @@ -0,0 +1,7 @@ +package com.inspur.edp.lcm.metadata.api.exception; + +public class LcmDeployToolException extends RuntimeException{ + public LcmDeployToolException(String messageParams) { + super(messageParams); + } +} diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java index 3c4c06f0c302aa14b2701583c1d0ff45979fbd44..2b37fbba916d12f21b923ea5eaf27d919f5b52b8 100644 --- a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java @@ -19,6 +19,7 @@ package com.inspur.edp.lcm.metadata.extend.action; import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; import com.inspur.edp.lcm.metadata.api.entity.DeploymentContext; import com.inspur.edp.lcm.metadata.api.exception.ErrorCodes; +import com.inspur.edp.lcm.metadata.api.exception.LcmDeployToolException; import com.inspur.edp.lcm.metadata.api.exception.LcmFileDevException; import com.inspur.edp.lcm.metadata.api.exception.LcmProcessException; import com.inspur.edp.lcm.metadata.api.service.FileService; @@ -65,7 +66,7 @@ public class DeployActionImpl implements DeployAction { if (!new File(server).exists()) { server = FileServiceImp.combinePath(serverPath, "server"); if (!new File(server).exists()) { - throw new LcmFileDevException(ErrorCodes.ECP_FILE_DEV_0008, serverPath); + throw new LcmDeployToolException(String.format("%s directory does not contain 'jstack' or 'server'", serverPath)); } } // copy @@ -76,6 +77,9 @@ public class DeployActionImpl implements DeployAction { if (dir.getName().equals("web")) { // copy String web = FileServiceImp.combinePath(serverPath, "web"); + if (!new File(web).exists()) { + throw new LcmDeployToolException(String.format("%s directory does not contain 'web'", serverPath)); + } fileService.folderCopy(dir.getAbsolutePath(), web); log.info("Deployment of web deliverables completed."); } @@ -140,7 +144,7 @@ public class DeployActionImpl implements DeployAction { output.close(); pro.destroy(); if (exceptonCatched) { - throw new LcmProcessException(ErrorCodes.ECP_PROCESS_0012, stringBuilder.toString()); + throw new LcmDeployToolException(String.format("Metadata deployment failed %s ", stringBuilder.toString())) ; } } catch (IOException e) { throw new LcmProcessException(e, ErrorCodes.ECP_PROCESS_0013, command, dir.getPath());