|
@@ -681,18 +681,15 @@ public class ResourcesService extends BaseService {
|
|
|
logger.info("resource hdfs path is {} ", hdfsFileName);
|
|
|
|
|
|
HadoopUtils hadoopUtils = HadoopUtils.getInstance();
|
|
|
- if (hadoopUtils.exists(resourcePath)) {
|
|
|
- if (hadoopUtils.exists(hdfsFileName)) {
|
|
|
- hadoopUtils.delete(hdfsFileName, false);
|
|
|
- }
|
|
|
-
|
|
|
- hadoopUtils.copyLocalToHdfs(localFilename, hdfsFileName, true, true);
|
|
|
- } else {
|
|
|
- logger.error("{} is not exist", resourcePath);
|
|
|
- result.setCode(Status.HDFS_OPERATION_ERROR.getCode());
|
|
|
- result.setMsg(String.format("%s is not exist", resourcePath));
|
|
|
- return result;
|
|
|
+ if (!hadoopUtils.exists(resourcePath)) {
|
|
|
+ // create if tenant dir not exists
|
|
|
+ createTenantDirIfNotExists(tenantCode);
|
|
|
+ }
|
|
|
+ if (hadoopUtils.exists(hdfsFileName)) {
|
|
|
+ hadoopUtils.delete(hdfsFileName, false);
|
|
|
}
|
|
|
+
|
|
|
+ hadoopUtils.copyLocalToHdfs(localFilename, hdfsFileName, true, true);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
result.setCode(Status.HDFS_OPERATION_ERROR.getCode());
|