Rebuild overlays for discovered nodes

- Fixes: #1468

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-07-09 14:29:38 -06:00
parent 4f63790896
commit a2c7caa4ba
5 changed files with 69 additions and 11 deletions

View File

@@ -105,3 +105,19 @@ func OverlayImage(nodeName string, context string, overlayNames []string) string
return path.Join(config.Get().Paths.OverlayProvisiondir(), nodeName, name)
}
func ClearOverlayImage(nodeName string, context string, overlayNames []string) error {
imagePath := OverlayImage(nodeName, context, overlayNames)
if util.IsFile(imagePath) {
if err := os.Remove(imagePath); err != nil {
return fmt.Errorf("failed to remove overlay image: %w", err)
}
}
compressedImagePath := imagePath + ".gz"
if util.IsFile(compressedImagePath) {
if err := os.Remove(compressedImagePath); err != nil {
return fmt.Errorf("failed to remove compressed overlay image: %w", err)
}
}
return nil
}