in bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java [345:369]
public static void updatePermissions(String dir, String permissions, boolean recursive) {
if (StringUtils.isBlank(dir)) {
log.error("dir must not be null");
return;
}
permissions = StringUtils.isBlank(permissions) ? Constants.PERMISSION_644 : permissions;
List<String> builderParameters = new ArrayList<>();
builderParameters.add("chmod");
if (recursive && Files.isDirectory(Paths.get(dir))) {
builderParameters.add("-R");
}
builderParameters.add(permissions);
builderParameters.add(dir);
try {
ShellResult shellResult = sudoExecCmd(builderParameters);
if (shellResult.getExitCode() != MessageConstants.SUCCESS_CODE) {
throw new StackException(shellResult.getErrMsg());
}
} catch (IOException e) {
throw new StackException(e);
}
}