Skip to content

Commit

Permalink
actions/overlay: Check source exists during recipe verification
Browse files Browse the repository at this point in the history
If an overlay coming from the recipe directory doesn't
exist, the recipe exits during execution. Let's check
early if the overlay exists on the host filesystem.

Signed-off-by: Christopher Obbard <[email protected]>
  • Loading branch information
obbardc committed Jan 12, 2022
1 parent a95ed84 commit 12bd81a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions actions/overlay_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package actions

import (
"fmt"
"os"
"path"

"github.com/go-debos/debos"
Expand All @@ -42,6 +43,13 @@ func (overlay *OverlayAction) Verify(context *debos.DebosContext) error {
if _, err := debos.RestrictedPath(context.Rootdir, overlay.Destination); err != nil {
return err
}

if len(overlay.Origin) == 0 {
if _, err := os.Stat(overlay.Source); err != nil {
return err
}
}

return nil
}

Expand Down

0 comments on commit 12bd81a

Please sign in to comment.