private int actionPackageDelete(ActionPackageArgs actionPackageArgs) throws YarnException, IOException { requireArgumentSet(Arguments.ARG_NAME, actionPackageArgs.name); Path pkgPath = sliderFileSystem.buildPackageDirPath(actionPackageArgs.name, actionPackageArgs.version); FileSystem fs = sliderFileSystem.getFileSystem(); require(fs.exists(pkgPath), E_PACKAGE_DOES_NOT_EXIST +": %s ", pkgPath.toUri()); log.info("Deleting package {} at {}.", actionPackageArgs.name, pkgPath); if(fs.delete(pkgPath, true)) { log.info("Deleted package {} " + actionPackageArgs.name); return EXIT_SUCCESS; } else { log.warn("Package deletion failed."); return EXIT_NOT_FOUND; } }
private int actionPackageDelete(ActionPackageArgs actionPackageArgs) throws YarnException, IOException { requireArgumentSet(Arguments.ARG_NAME, actionPackageArgs.name); Path pkgPath = sliderFileSystem.buildPackageDirPath(actionPackageArgs.name, actionPackageArgs.version); FileSystem fs = sliderFileSystem.getFileSystem(); require(fs.exists(pkgPath), E_PACKAGE_DOES_NOT_EXIST +": %s ", pkgPath.toUri()); log.info("Deleting package {} at {}.", actionPackageArgs.name, pkgPath); if(fs.delete(pkgPath, true)) { log.info("Deleted package {} ", actionPackageArgs.name); return EXIT_SUCCESS; } else { log.warn("Package deletion failed."); return EXIT_NOT_FOUND; } }
private int actionPackageList() throws IOException { Path pkgPath = sliderFileSystem.buildPackageDirPath(StringUtils.EMPTY, StringUtils.EMPTY); log.info("Package install path : {}", pkgPath); FileSystem sfs = sliderFileSystem.getFileSystem(); if (!sfs.isDirectory(pkgPath)) { log.info("No package(s) installed"); return EXIT_SUCCESS; } FileStatus[] fileStatus = sfs.listStatus(pkgPath); boolean hasPackage = false; StringBuilder sb = new StringBuilder(); sb.append("List of installed packages:\n"); for (FileStatus fstat : fileStatus) { if (fstat.isDirectory()) { sb.append("\t").append(fstat.getPath().getName()); sb.append("\n"); hasPackage = true; } } if (hasPackage) { println(sb.toString()); } else { log.info("No package(s) installed"); } return EXIT_SUCCESS; }
private int actionPackageList() throws IOException { Path pkgPath = sliderFileSystem.buildPackageDirPath(StringUtils.EMPTY, StringUtils.EMPTY); log.info("Package install path : {}", pkgPath); FileSystem sfs = sliderFileSystem.getFileSystem(); if (!sfs.isDirectory(pkgPath)) { log.info("No package(s) installed"); return EXIT_SUCCESS; } FileStatus[] fileStatus = sfs.listStatus(pkgPath); boolean hasPackage = false; StringBuilder sb = new StringBuilder(); sb.append("List of installed packages:\n"); for (FileStatus fstat : fileStatus) { if (fstat.isDirectory()) { sb.append("\t").append(fstat.getPath().getName()); sb.append("\n"); hasPackage = true; } } if (hasPackage) { println(sb.toString()); } else { log.info("No package(s) installed"); } return EXIT_SUCCESS; }
@Override public int actionInstallPkg(ActionInstallPackageArgs installPkgInfo) throws YarnException, IOException { log.warn("The " + ACTION_INSTALL_PACKAGE + " option has been deprecated. Please use '" + ACTION_PACKAGE + " " + ClientArgs.ARG_INSTALL + "'."); if (StringUtils.isEmpty(installPkgInfo.name)) { throw new BadCommandArgumentsException( E_INVALID_APPLICATION_TYPE_NAME + "\n" + CommonArgs.usage(serviceArgs, ACTION_INSTALL_PACKAGE)); } Path srcFile = extractPackagePath(installPkgInfo.packageURI); // Do not provide new options to install-package command as it is in // deprecated mode. So version is kept null here. Use package --install. Path pkgPath = sliderFileSystem.buildPackageDirPath(installPkgInfo.name, null); FileSystem sfs = sliderFileSystem.getFileSystem(); sfs.mkdirs(pkgPath); Path fileInFs = new Path(pkgPath, srcFile.getName()); log.info("Installing package {} at {} and overwrite is {}.", srcFile, fileInFs, installPkgInfo.replacePkg); require(!(sfs.exists(fileInFs) && !installPkgInfo.replacePkg), "Package exists at %s. : %s", fileInFs.toUri(), E_USE_REPLACEPKG_TO_OVERWRITE); sfs.copyFromLocalFile(false, installPkgInfo.replacePkg, srcFile, fileInFs); return EXIT_SUCCESS; }
@Override public int actionInstallPkg(ActionInstallPackageArgs installPkgInfo) throws YarnException, IOException { log.warn("The " + ACTION_INSTALL_PACKAGE + " option has been deprecated. Please use '" + ACTION_PACKAGE + " " + ClientArgs.ARG_INSTALL + "'."); if (StringUtils.isEmpty(installPkgInfo.name)) { throw new BadCommandArgumentsException( E_INVALID_APPLICATION_TYPE_NAME + "\n" + CommonArgs.usage(serviceArgs, ACTION_INSTALL_PACKAGE)); } Path srcFile = extractPackagePath(installPkgInfo.packageURI); // Do not provide new options to install-package command as it is in // deprecated mode. So version is kept null here. Use package --install. Path pkgPath = sliderFileSystem.buildPackageDirPath(installPkgInfo.name, null); FileSystem sfs = sliderFileSystem.getFileSystem(); sfs.mkdirs(pkgPath); Path fileInFs = new Path(pkgPath, srcFile.getName()); log.info("Installing package {} at {} and overwrite is {}.", srcFile, fileInFs, installPkgInfo.replacePkg); require(!(sfs.exists(fileInFs) && !installPkgInfo.replacePkg), "Package exists at %s. : %s", fileInFs.toUri(), E_USE_REPLACEPKG_TO_OVERWRITE); sfs.copyFromLocalFile(false, installPkgInfo.replacePkg, srcFile, fileInFs); return EXIT_SUCCESS; }
Path pkgPath = sliderFileSystem.buildPackageDirPath(actionPackageArgs.name, actionPackageArgs.version); FileSystem fs = sliderFileSystem.getFileSystem();
Path pkgPath = sliderFileSystem.buildPackageDirPath(actionPackageArgs.name, actionPackageArgs.version); FileSystem fs = sliderFileSystem.getFileSystem();
.buildPackageDirPath(StringUtils.EMPTY, StringUtils.EMPTY).toUri() .getPath(); FileSystem fs = sliderFileSystem.getFileSystem();
.buildPackageDirPath(StringUtils.EMPTY, StringUtils.EMPTY).toUri() .getPath(); FileSystem fs = sliderFileSystem.getFileSystem();