Log registry refresh errors in cdi list

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-08-08 15:53:43 +02:00
parent 4c513d536b
commit feb069a2e9

View File

@ -72,13 +72,12 @@ func (m command) run(c *cli.Context, cfg *config) error {
return fmt.Errorf("failed to create CDI cache: %v", err) return fmt.Errorf("failed to create CDI cache: %v", err)
} }
refreshErr := registry.Refresh()
devices := registry.ListDevices() devices := registry.ListDevices()
if len(devices) == 0 {
m.logger.Info("No CDI devices found")
return nil
}
m.logger.Infof("Found %d CDI devices", len(devices)) m.logger.Infof("Found %d CDI devices", len(devices))
if refreshErr != nil {
m.logger.Warningf("Refreshing the CDI registry returned the following error(s): %v", refreshErr)
}
for _, device := range devices { for _, device := range devices {
fmt.Printf("%s\n", device) fmt.Printf("%s\n", device)
} }