diff --git a/internal/discover/graphics.go b/internal/discover/graphics.go index fca66579..2a9f3d72 100644 --- a/internal/discover/graphics.go +++ b/internal/discover/graphics.go @@ -95,21 +95,21 @@ func NewGraphicsMountsDiscoverer(logger *logrus.Logger, root string) (Discover, type drmDevicesByPath struct { None - logger *logrus.Logger - lookup lookup.Locator - nvidiaCTKExecutablePath string - root string - devicesFrom Discover + logger *logrus.Logger + lookup lookup.Locator + nvidiaCTKPath string + root string + devicesFrom Discover } // newCreateDRMByPathSymlinks creates a discoverer for a hook to create the by-path symlinks for DRM devices discovered by the specified devices discoverer func newCreateDRMByPathSymlinks(logger *logrus.Logger, devices Discover, cfg *Config) Discover { d := drmDevicesByPath{ - logger: logger, - lookup: lookup.NewExecutableLocator(logger, cfg.Root), - nvidiaCTKExecutablePath: cfg.NvidiaCTKPath, - root: cfg.Root, - devicesFrom: devices, + logger: logger, + lookup: lookup.NewExecutableLocator(logger, cfg.Root), + nvidiaCTKPath: cfg.NvidiaCTKPath, + root: cfg.Root, + devicesFrom: devices, } return &d @@ -133,13 +133,13 @@ func (d drmDevicesByPath) Hooks() ([]Hook, error) { } hookPath := nvidiaCTKDefaultFilePath - targets, err := d.lookup.Locate(d.nvidiaCTKExecutablePath) + targets, err := d.lookup.Locate(d.nvidiaCTKPath) if err != nil { - d.logger.Warnf("Failed to locate %v: %v", d.nvidiaCTKExecutablePath, err) + d.logger.Warnf("Failed to locate %v: %v", d.nvidiaCTKPath, err) } else if len(targets) == 0 { - d.logger.Warnf("%v not found", d.nvidiaCTKExecutablePath) + d.logger.Warnf("%v not found", d.nvidiaCTKPath) } else { - d.logger.Debugf("Found %v candidates: %v", d.nvidiaCTKExecutablePath, targets) + d.logger.Debugf("Found %v candidates: %v", d.nvidiaCTKPath, targets) hookPath = targets[0] } d.logger.Debugf("Using NVIDIA Container Toolkit CLI path %v", hookPath) diff --git a/internal/discover/ldconfig.go b/internal/discover/ldconfig.go index 48ad6611..308f6371 100644 --- a/internal/discover/ldconfig.go +++ b/internal/discover/ldconfig.go @@ -29,10 +29,10 @@ import ( // NewLDCacheUpdateHook creates a discoverer that updates the ldcache for the specified mounts. A logger can also be specified func NewLDCacheUpdateHook(logger *logrus.Logger, mounts Discover, cfg *Config) (Discover, error) { d := ldconfig{ - logger: logger, - mountsFrom: mounts, - lookup: lookup.NewExecutableLocator(logger, cfg.Root), - nvidiaCTKExecutablePath: cfg.NvidiaCTKPath, + logger: logger, + mountsFrom: mounts, + lookup: lookup.NewExecutableLocator(logger, cfg.Root), + nvidiaCTKPath: cfg.NvidiaCTKPath, } return &d, nil @@ -44,10 +44,10 @@ const ( type ldconfig struct { None - logger *logrus.Logger - mountsFrom Discover - lookup lookup.Locator - nvidiaCTKExecutablePath string + logger *logrus.Logger + mountsFrom Discover + lookup lookup.Locator + nvidiaCTKPath string } // Hooks checks the required mounts for libraries and returns a hook to update the LDcache for the discovered paths. @@ -57,7 +57,7 @@ func (d ldconfig) Hooks() ([]Hook, error) { return nil, fmt.Errorf("failed to discover mounts for ldcache update: %v", err) } h := CreateLDCacheUpdateHook( - d.nvidiaCTKExecutablePath, + d.nvidiaCTKPath, getLibraryPaths(mounts), ) return []Hook{h}, nil diff --git a/internal/discover/symlinks.go b/internal/discover/symlinks.go index 15f1b0a4..0507f699 100644 --- a/internal/discover/symlinks.go +++ b/internal/discover/symlinks.go @@ -28,21 +28,21 @@ import ( type symlinks struct { None - logger *logrus.Logger - lookup lookup.Locator - nvidiaCTKExecutablePath string - csvFiles []string - mountsFrom Discover + logger *logrus.Logger + lookup lookup.Locator + nvidiaCTKPath string + csvFiles []string + mountsFrom Discover } // NewCreateSymlinksHook creates a discoverer for a hook that creates required symlinks in the container func NewCreateSymlinksHook(logger *logrus.Logger, csvFiles []string, mounts Discover, cfg *Config) (Discover, error) { d := symlinks{ - logger: logger, - lookup: lookup.NewExecutableLocator(logger, cfg.Root), - nvidiaCTKExecutablePath: cfg.NvidiaCTKPath, - csvFiles: csvFiles, - mountsFrom: mounts, + logger: logger, + lookup: lookup.NewExecutableLocator(logger, cfg.Root), + nvidiaCTKPath: cfg.NvidiaCTKPath, + csvFiles: csvFiles, + mountsFrom: mounts, } return &d, nil @@ -51,13 +51,13 @@ func NewCreateSymlinksHook(logger *logrus.Logger, csvFiles []string, mounts Disc // Hooks returns a hook to create the symlinks from the required CSV files func (d symlinks) Hooks() ([]Hook, error) { hookPath := nvidiaCTKDefaultFilePath - targets, err := d.lookup.Locate(d.nvidiaCTKExecutablePath) + targets, err := d.lookup.Locate(d.nvidiaCTKPath) if err != nil { - d.logger.Warnf("Failed to locate %v: %v", d.nvidiaCTKExecutablePath, err) + d.logger.Warnf("Failed to locate %v: %v", d.nvidiaCTKPath, err) } else if len(targets) == 0 { - d.logger.Warnf("%v not found", d.nvidiaCTKExecutablePath) + d.logger.Warnf("%v not found", d.nvidiaCTKPath) } else { - d.logger.Debugf("Found %v candidates: %v", d.nvidiaCTKExecutablePath, targets) + d.logger.Debugf("Found %v candidates: %v", d.nvidiaCTKPath, targets) hookPath = targets[0] } d.logger.Debugf("Using NVIDIA Container Toolkit CLI path %v", hookPath)