Skip to content

Commit

Permalink
lxd/rsync: Add description of cleanup function to RunWrappers
Browse files Browse the repository at this point in the history
Signed-off-by: Max Asnaashari <[email protected]>
  • Loading branch information
masnax committed Feb 21, 2024
1 parent 96cee1e commit ae63aec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lxd/apparmor/rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ profile "{{ .name }}" flags=(attach_disconnected,mediate_deleted) {
`))

// RsyncWrapper is used as a RunWrapper in the rsync package.
// It returns a cleanup function that deletes the AppArmor profile that the command is running in.
func RsyncWrapper(sysOS *sys.OS, cmd *exec.Cmd, sourcePath string, dstPath string) (func(), error) {
if !sysOS.AppArmorAvailable {
return func() {}, nil
Expand Down
1 change: 1 addition & 0 deletions lxd/rsync/rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
var Debug bool

// RunWrapper is an optional function that's used to wrap rsync, useful for confinement like AppArmor.
// It returns a cleanup function that will close the wrapper's environment, and should be called after the command has completed.
var RunWrapper func(cmd *exec.Cmd, source string, destination string) (func(), error)

// rsync is a wrapper for the rsync command which will respect RunWrapper.
Expand Down

0 comments on commit ae63aec

Please sign in to comment.