Skip to content

Commit

Permalink
fix: change ownership for target path
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmyagkov committed Oct 4, 2024
1 parent bde916d commit 83eece4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cloud/blockstore/tools/csi_driver/internal/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,20 @@ func (s *nodeService) nodePublishDiskAsFilesystem(
}
}

return s.mounter.Mount(req.StagingTargetPath, req.TargetPath, "", mountOptions)
err := s.mounter.Mount(req.StagingTargetPath, req.TargetPath, "", mountOptions)
if err != nil {
return err
}

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

return nil
}

func (s *nodeService) nodeStageDiskAsFilesystem(
Expand Down

0 comments on commit 83eece4

Please sign in to comment.