Skip to content

Commit 43e2b4b

Browse files
committed
rhel: update backup content-manifest path
This patch adds another glob to check for the content_manifest file on a filesystem, namely: usr/share/buildinfo/content_manifests/*.json. Signed-off-by: crozzy <joseph.crosland@gmail.com>
1 parent f00684c commit 43e2b4b

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

rhel/rhel.go

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,31 @@ import (
1616
"log/slog"
1717
)
1818

19+
var contentManifestBlobs = []string{
20+
`root/buildinfo/content_manifests/*.json`,
21+
`usr/share/buildinfo/content_manifests/*.json`,
22+
`usr/share/buildinfo/*.json`,
23+
}
24+
1925
// GetContentManifest reads and parses the content manifest file from the layer.
20-
// Content manifest files are stored in /root/buildinfo/content_manifests/ or
21-
// /usr/share/buildinfo/ (for RHCOS) and contain information about how the container
22-
// should be processed.
26+
// Content manifest files are stored in /root/buildinfo/content_manifests/,
27+
// /usr/share/buildinfo/ (for RHCOS) or /usr/share/buildinfo/content_manifests/
28+
// (for other images) and contain information about how the container should be processed.
2329
func getContentManifest(ctx context.Context, sys fs.FS) (*contentManifest, error) {
24-
ms, err := fs.Glob(sys, `root/buildinfo/content_manifests/*.json`)
25-
if err != nil {
26-
panic("programmer error: " + err.Error())
27-
}
28-
ms2, err := fs.Glob(sys, `usr/share/buildinfo/*.json`)
29-
if err != nil {
30-
panic("programmer error: " + err.Error())
30+
var p string
31+
for _, g := range contentManifestBlobs {
32+
ms, err := fs.Glob(sys, g)
33+
if err != nil {
34+
panic("programmer error: " + err.Error())
35+
}
36+
if len(ms) > 0 {
37+
p = ms[0]
38+
break
39+
}
3140
}
32-
ms = append(ms, ms2...)
33-
if ms == nil {
41+
if p == "" {
3442
return nil, nil
3543
}
36-
p := ms[0]
3744
slog.DebugContext(ctx, "found content manifest file", "manifest-path", p)
3845
b, err := fs.ReadFile(sys, p)
3946
if err != nil {

0 commit comments

Comments
 (0)