Use NewCache instead of GetRegistry

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2024-04-05 17:09:17 +02:00
parent 885313af3b
commit 4cd86caf67

View File

@ -47,12 +47,11 @@ func (s *spec) Save(path string) error {
} }
specDir := filepath.Dir(path) specDir := filepath.Dir(path)
registry := cdi.GetRegistry( cache, _ := cdi.NewCache(
cdi.WithAutoRefresh(false), cdi.WithAutoRefresh(false),
cdi.WithSpecDirs(specDir), cdi.WithSpecDirs(specDir),
) )
if err := cache.WriteSpec(s.Raw(), filepath.Base(path)); err != nil {
if err := registry.SpecDB().WriteSpec(s.Raw(), filepath.Base(path)); err != nil {
return fmt.Errorf("failed to write spec: %w", err) return fmt.Errorf("failed to write spec: %w", err)
} }