Skip to content

Commit

Permalink
Check if artifactdir exists early
Browse files Browse the repository at this point in the history
Currently debos fails if an action attempts to use artifactdir and it
doesn't exist on the host:

  $ debos --artifactdir=out rpi64/debimage-rpi64.yaml
  Action `image-partition` failed at stage PreMachine, error: open /home/obbardc/projects/debos/debos-recipes/out/debian-rpi64.img: no such file or directory

Check that artifactdir exists early and return an error in case that it
does not exist.

Closes: #426
Signed-off-by: Christopher Obbard <[email protected]>
  • Loading branch information
obbardc committed Aug 11, 2023
1 parent df4f717 commit f334d32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/debos/debos.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ func main() {
context.Artifactdir, _ = os.Getwd()
}
context.Artifactdir = debos.CleanPath(context.Artifactdir)
if _, err := os.Stat(context.Artifactdir); os.IsNotExist(err) {
log.Printf("artifactdir does not exist: %v", err)
exitcode = 1
return
}

// Initialise origins map
context.Origins = make(map[string]string)
Expand Down

0 comments on commit f334d32

Please sign in to comment.