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.
16 lines
296 B
Go
16 lines
296 B
Go
package mkdir
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"github.com/warewulf/warewulf/internal/pkg/overlay"
|
|
)
|
|
|
|
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
|
|
|
myOverlay, err := overlay.GetOverlay(args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return myOverlay.Mkdir(args[1], PermMode)
|
|
}
|