From 7d4b7ab432361d5c0b2f09de3e173a47958d282d Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Wed, 18 Dec 2024 09:23:45 -0700 Subject: [PATCH] Remove OverlayDoesNotExistError - No receiver of the error is checking its type - No receiver of the error is checking its `Name` attribute - Any receiver of the error knows the name already Signed-off-by: Jonathon Anderson --- internal/pkg/overlay/config.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/internal/pkg/overlay/config.go b/internal/pkg/overlay/config.go index 0d92bb92..f08168ed 100644 --- a/internal/pkg/overlay/config.go +++ b/internal/pkg/overlay/config.go @@ -79,13 +79,13 @@ func CreateSiteOverlay(overlayName string) (overlayPath string, err error) { // Creates a site overlay from an existing distribution overlay. // -// If the distribution overlay doesn't exist, return an OverlayDoesNotExist error. +// If the distribution overlay doesn't exist, return an error. func CloneSiteOverlay(name string) (err error) { controller := warewulfconf.Get() distroPath := path.Join(controller.Paths.DistributionOverlaydir(), name) sitePath := path.Join(controller.Paths.SiteOverlaydir(), name) if !util.IsDir(distroPath) { - return &OverlayDoesNotExist{Name: name} + return fmt.Errorf("overlay %s does not exist", name) } err = copy.DirCopy(distroPath, sitePath, copy.Content, true) return err @@ -120,11 +120,3 @@ func OverlayImage(nodeName string, context string, overlayNames []string) string conf := warewulfconf.Get() return path.Join(conf.Paths.OverlayProvisiondir(), nodeName, name) } - -type OverlayDoesNotExist struct { - Name string -} - -func (e *OverlayDoesNotExist) Error() string { - return fmt.Sprintf("overlay %s does not exist", e.Name) -}