Skip to content

Commit

Permalink
issue-2091: recursive chmod
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmyagkov committed Nov 6, 2024
1 parent b6ac88b commit 38ee48e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cloud/blockstore/tools/csi_driver/internal/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,14 @@ func (s *nodeService) nodePublishDiskAsFilesystemDeprecated(
return fmt.Errorf("failed to chown %s to %q: %w, output %q",
mnt.VolumeMountGroup, req.TargetPath, err, out)
}

if !req.Readonly {
cmd = exec.Command("chmod", "-R", "g+w", req.TargetPath)
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("failed to chmod %q: %w, output %q",
req.TargetPath, err, out)
}
}
}

return nil
Expand Down Expand Up @@ -688,6 +696,14 @@ func (s *nodeService) nodePublishDiskAsFilesystem(
return fmt.Errorf("failed to chown %s to %q: %w, output %q",
mnt.VolumeMountGroup, req.TargetPath, err, out)
}

if !req.Readonly {
cmd = exec.Command("chmod", "-R", "g+w", req.TargetPath)
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("failed to chmod %q: %w, output %q",
req.TargetPath, err, out)
}
}
}

return nil
Expand Down

0 comments on commit 38ee48e

Please sign in to comment.