public static void updateOwner()

in bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java [379:405]


    public static void updateOwner(String dir, String owner, String group, boolean recursive) {
        if (StringUtils.isBlank(dir)) {
            log.error("dir must not be null");
            return;
        }

        owner = StringUtils.isBlank(owner) ? "root" : owner;
        group = StringUtils.isBlank(group) ? "root" : group;

        List<String> builderParameters = new ArrayList<>();

        builderParameters.add("chown");
        if (recursive && Files.isDirectory(Paths.get(dir))) {
            builderParameters.add("-R");
        }
        builderParameters.add(owner + ":" + group);
        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);
        }
    }