Skip to content

Commit fded3d1

Browse files
committed
OCPBUGS-63326: Indicate successful boot artifact downloads
In the event the step processor creates this step more than once, we don't want to redo any of the previous steps so we should indicate if it's already successful.
1 parent 44150c1 commit fded3d1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/commands/actions/download_boot_artifacts_cmd.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ initrd %s`
7979
)
8080

8181
func run(infraEnvId, downloaderRequestStr, caCertPath string) error {
82+
if _, err := os.Stat(path.Join(tempBootArtifactsFolder, "boot_artifacts_moved")); err == nil {
83+
log.Info("Boot artifacts already successfully downloaded")
84+
return nil
85+
}
86+
8287
var req models.DownloadBootArtifactsRequest
8388
if err := json.Unmarshal([]byte(downloaderRequestStr), &req); err != nil {
8489
return fmt.Errorf("failed unmarshalling download boot artifacts request: %w", err)
@@ -335,7 +340,10 @@ func moveFilesToBootFolder(folders *folders) error {
335340
return fmt.Errorf("failed moving files from %s to %s: %w", tempBootArtifactsFolder, folders.bootLoaderFolder, err)
336341
}
337342

338-
log.Infof("Successfully moved files to /boot folder.")
343+
log.Info("Successfully moved files to /boot folder.")
344+
if err := os.WriteFile(path.Join(tempBootArtifactsFolder, "boot_artifacts_moved"), []byte("true"), 0644); err != nil {
345+
return fmt.Errorf("failed to write successful artifacts file: %w", err)
346+
}
339347
return nil
340348
}
341349

0 commit comments

Comments
 (0)