Skip to content

Commit c9771a8

Browse files
committed
ignore ENOENT errors when parsing registries.conf.d files
As always listing files in a dir to then read them is racy as the file might have been removed in the meantime. Thus we must ignore ENOENT errors when the file is opened. Signed-off-by: Paul Holzinger <[email protected]>
1 parent 1294122 commit c9771a8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/sysregistriesv2/system_registries_v2.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package sysregistriesv2
22

33
import (
4+
"errors"
45
"fmt"
56
"io/fs"
67
"os"
@@ -744,6 +745,11 @@ func tryUpdatingCache(ctx *types.SystemContext, wrapper configWrapper) (*parsedC
744745
// Enforce v2 format for drop-in-configs.
745746
dropIn, err := loadConfigFile(path, true)
746747
if err != nil {
748+
if errors.Is(err, fs.ErrNotExist) {
749+
// file must have been removed between the directory listing
750+
// and the open call, ignore that as it is a expected race
751+
continue
752+
}
747753
return nil, fmt.Errorf("loading drop-in registries configuration %q: %w", path, err)
748754
}
749755
config.updateWithConfigurationFrom(dropIn)

0 commit comments

Comments
 (0)