From f73e28164cbc1b235de7020b9a856d9ea212e90d Mon Sep 17 00:00:00 2001 From: Dmitry Ukov Date: Mon, 14 Oct 2019 10:04:44 +0000 Subject: [PATCH] [AIR-137] Add ISO builder artifacts check Change-Id: I0f454d56044c6f477b0e4fae18ea0bef8738715d --- pkg/bootstrap/isogen/command.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/bootstrap/isogen/command.go b/pkg/bootstrap/isogen/command.go index 70e811047..fe3b0ad3c 100644 --- a/pkg/bootstrap/isogen/command.go +++ b/pkg/bootstrap/isogen/command.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "os" "path/filepath" "strings" @@ -51,7 +52,13 @@ func GenerateBootstrapIso(settings *Settings, args []string, out io.Writer) erro return err } - return generateBootstrapIso(docBundle, builder, cfg, out, settings.Debug) + err = generateBootstrapIso(docBundle, builder, cfg, out, settings.Debug) + if err != nil { + return err + } + fmt.Fprintln(out, "Checking artifacts") + return verifyArtifacts(cfg) + } func verifyInputs(cfg *Config, args []string, out io.Writer) error { @@ -95,6 +102,13 @@ func getContainerCfg(cfg *Config, userData []byte, netConf []byte) (map[string][ return fls, nil } +func verifyArtifacts(cfg *Config) error { + hostVol := strings.Split(cfg.Container.Volume, ":")[0] + metadataPath := filepath.Join(hostVol, cfg.Builder.OutputMetadataFileName) + _, err := os.Stat(metadataPath) + return err +} + func generateBootstrapIso( docBubdle document.Bundle, builder container.Container,