Files
warewulf/internal/app/wwctl/overlay/chmod/main.go
Christian Goll 6f4fd60d8f refactored overlay class
overlay.GetOverlay(name) returns now an error if the overlay doesn't
exist. This is the most canonical way to act if there is no overlay.
2025-08-27 22:24:31 -06:00

24 lines
472 B
Go

package chmod
import (
"fmt"
"strconv"
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/pkg/overlay"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
myOverlay, err := overlay.GetOverlay(args[0])
if err != nil {
return err
}
path := args[1]
permissionMode, err := strconv.ParseUint(args[2], 8, 32)
if err != nil {
return fmt.Errorf("could not convert requested mode: %s", err)
}
return myOverlay.Chmod(path, permissionMode)
}