Skip to content

Commit c6d1d5c

Browse files
committed
Remove deprecated registry API
Signed-off-by: Ed Bartosh <[email protected]>
1 parent 1057f0e commit c6d1d5c

File tree

6 files changed

+19
-1014
lines changed

6 files changed

+19
-1014
lines changed

cmd/cdi/cmd/monitor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ information to show upon each refresh.`,
4848

4949
func monitorSpecDirs(args ...string) {
5050
var (
51-
registry = cdi.GetRegistry()
52-
specDirs = registry.GetSpecDirectories()
51+
cache = cdi.GetDefaultCache()
52+
specDirs = cache.GetSpecDirectories()
5353
dirWatch *fsnotify.Watcher
5454
err error
5555
done chan error

cmd/cdi/cmd/root.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ func initSpecDirs() {
6868
cdi.SetSpecValidator(validate.WithSchema(s))
6969

7070
if len(specDirs) > 0 {
71-
cdi.GetRegistry(
72-
cdi.WithSpecDirs(specDirs...),
73-
)
74-
if len(cdi.GetRegistry().GetErrors()) > 0 {
71+
cache := cdi.GetDefaultCache()
72+
if err := cache.Configure(cdi.WithSpecDirs(specDirs...)); err != nil {
73+
fmt.Printf("failed to configure CDI cache: %v\n", err)
74+
}
75+
if len(cache.GetErrors()) > 0 {
7576
cdiPrintCacheErrors()
7677
}
7778
}

cmd/cdi/cmd/validate.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ The 'validate' command lists errors encountered during the population
3535
of the CDI registry. It exits with an exit status of 1 if any errors
3636
were reported by the registry.`,
3737
Run: func(cmd *cobra.Command, args []string) {
38-
cdiErrors := cdi.GetRegistry().GetErrors()
38+
cache := cdi.GetDefaultCache()
39+
cdiErrors := cache.GetErrors()
3940
if len(cdiErrors) == 0 {
40-
fmt.Printf("No CDI Registry errors.\n")
41+
fmt.Printf("No CDI Cache errors.\n")
4142
return
4243
}
4344

44-
fmt.Printf("CDI Registry has errors:\n")
45+
fmt.Printf("CDI Cache has errors:\n")
4546
for path, specErrors := range cdiErrors {
4647
fmt.Printf("Spec file %s:\n", path)
4748
for idx, err := range specErrors {

pkg/cdi/registry.go

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)