diff --git a/actions/overlay_action.go b/actions/overlay_action.go index 2b597ce2..1d930405 100644 --- a/actions/overlay_action.go +++ b/actions/overlay_action.go @@ -27,6 +27,7 @@ package actions import ( "fmt" "log" + "os" "path" "github.com/go-debos/debos" @@ -43,6 +44,15 @@ func (overlay *OverlayAction) Verify(context *debos.DebosContext) error { if _, err := debos.RestrictedPath(context.Rootdir, overlay.Destination); err != nil { return err } + + /* only check default origin recipedir */ + if len(overlay.Origin) == 0 { + sourceDir := path.Join(context.RecipeDir, overlay.Source) + if _, err := os.Stat(sourceDir); err != nil { + return err + } + } + return nil } diff --git a/tests/overlay-non-existent-destination/overlay-non-existent-destination.yaml b/tests/overlay-non-existent-destination/overlay-non-existent-destination.yaml deleted file mode 100644 index 473a42da..00000000 --- a/tests/overlay-non-existent-destination/overlay-non-existent-destination.yaml +++ /dev/null @@ -1,17 +0,0 @@ -architecture: amd64 - -actions: - # This overlay action is expected to error out here because the destination - # doesn't exist in the filesystem. - - action: overlay - description: Overlay file into a non-existent destination - source: overlay-non-existent-destination.yaml - destination: /this/path/does/not/exist/overlay-non-existent-destination.yaml - - - action: run - description: Check if path exists - command: "[ -e /this/path/does/not/exist/overlay-non-existent-destination.yaml ] || exit 1" - - - action: run - postprocess: true - command: echo Test