From 62456b212befc4b0f2a4646bfbdbf9fe0476cfc9 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 20 Feb 2026 11:27:20 +0100 Subject: [PATCH] Revert to default spec dirs if none are specified Instead of accepting an empty list of spec dirs, we explicitly revert to the default spec dirs to ensure that we don't configure a cache with no spec dirs specified. Signed-off-by: Evan Lezar --- pkg/cdi/spec-dirs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cdi/spec-dirs.go b/pkg/cdi/spec-dirs.go index b192f962..df64c219 100644 --- a/pkg/cdi/spec-dirs.go +++ b/pkg/cdi/spec-dirs.go @@ -43,6 +43,10 @@ var ( // WithSpecDirs returns an option to override the CDI Spec directories. func WithSpecDirs(dirs ...string) Option { + // If no spec dirs are specified use the default spec dirs. + if len(dirs) == 0 { + return WithSpecDirs(DefaultSpecDirs...) + } return func(c *Cache) { specDirs := make([]string, len(dirs)) for i, dir := range dirs {