Skip to content

Commit

Permalink
Merge pull request #57 from kan-izh/master
Browse files Browse the repository at this point in the history
Ignore file permission change if unsupported by filesystem
  • Loading branch information
axdotl authored Aug 30, 2019
2 parents 5307c52 + 93ffc0f commit e2cad21
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main/java/com/kiwigrid/helm/maven/plugin/InitMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ protected void downloadAndUnpackHelm() throws MojoExecutionException {
IOUtils.copy(is, output);
}

Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(helm);
permissions.add(PosixFilePermission.OWNER_EXECUTE);
Files.setPosixFilePermissions(helm, permissions);
addExecPermission(helm);

found = true;
break;
Expand All @@ -127,6 +125,18 @@ protected void downloadAndUnpackHelm() throws MojoExecutionException {
initHelmClient();
}

private void addExecPermission(final Path helm) throws IOException {
final Set<PosixFilePermission> permissions;
try {
permissions = Files.getPosixFilePermissions(helm);
} catch (UnsupportedOperationException e) {
getLog().debug("Exec file permission is not set", e);
return;
}
permissions.add(PosixFilePermission.OWNER_EXECUTE);
Files.setPosixFilePermissions(helm, permissions);
}

private void verifyLocalHelmBinary() throws MojoExecutionException {
callCli(getHelmExecuteablePath() + " version --client", "Unable to verify local HELM binary", false);
initHelmClient();
Expand Down

0 comments on commit e2cad21

Please sign in to comment.