From 09d42f0ad94f66b1a41ff8ed3f0600c97f84881f Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 18 Jan 2023 11:41:29 +0100 Subject: [PATCH] Remove 'Executable' from config struct member Signed-off-by: Evan Lezar --- internal/discover/discover.go | 7 ++++--- internal/discover/graphics.go | 2 +- internal/discover/ldconfig.go | 2 +- internal/discover/ldconfig_test.go | 4 ++-- internal/discover/symlinks.go | 2 +- internal/modifier/csv.go | 4 ++-- internal/modifier/graphics.go | 4 ++-- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/discover/discover.go b/internal/discover/discover.go index e65b360e..23dc4c13 100644 --- a/internal/discover/discover.go +++ b/internal/discover/discover.go @@ -18,8 +18,8 @@ package discover // Config represents the configuration options for discovery type Config struct { - Root string - NVIDIAContainerToolkitCLIExecutablePath string + Root string + NvidiaCTKPath string } // Device represents a discovered character device. @@ -41,8 +41,9 @@ type Hook struct { Args []string } -//go:generate moq -stub -out discover_mock.go . Discover // Discover defines an interface for discovering the devices, mounts, and hooks available on a system +// +//go:generate moq -stub -out discover_mock.go . Discover type Discover interface { Devices() ([]Device, error) Mounts() ([]Mount, error) diff --git a/internal/discover/graphics.go b/internal/discover/graphics.go index ab858405..fca66579 100644 --- a/internal/discover/graphics.go +++ b/internal/discover/graphics.go @@ -107,7 +107,7 @@ func newCreateDRMByPathSymlinks(logger *logrus.Logger, devices Discover, cfg *Co d := drmDevicesByPath{ logger: logger, lookup: lookup.NewExecutableLocator(logger, cfg.Root), - nvidiaCTKExecutablePath: cfg.NVIDIAContainerToolkitCLIExecutablePath, + nvidiaCTKExecutablePath: cfg.NvidiaCTKPath, root: cfg.Root, devicesFrom: devices, } diff --git a/internal/discover/ldconfig.go b/internal/discover/ldconfig.go index 19430041..48ad6611 100644 --- a/internal/discover/ldconfig.go +++ b/internal/discover/ldconfig.go @@ -32,7 +32,7 @@ func NewLDCacheUpdateHook(logger *logrus.Logger, mounts Discover, cfg *Config) ( logger: logger, mountsFrom: mounts, lookup: lookup.NewExecutableLocator(logger, cfg.Root), - nvidiaCTKExecutablePath: cfg.NVIDIAContainerToolkitCLIExecutablePath, + nvidiaCTKExecutablePath: cfg.NvidiaCTKPath, } return &d, nil diff --git a/internal/discover/ldconfig_test.go b/internal/discover/ldconfig_test.go index e160e437..daf5465c 100644 --- a/internal/discover/ldconfig_test.go +++ b/internal/discover/ldconfig_test.go @@ -32,8 +32,8 @@ func TestLDCacheUpdateHook(t *testing.T) { logger, _ := testlog.NewNullLogger() cfg := Config{ - Root: "/", - NVIDIAContainerToolkitCLIExecutablePath: testNvidiaCTKPath, + Root: "/", + NvidiaCTKPath: testNvidiaCTKPath, } testCases := []struct { diff --git a/internal/discover/symlinks.go b/internal/discover/symlinks.go index b758100b..15f1b0a4 100644 --- a/internal/discover/symlinks.go +++ b/internal/discover/symlinks.go @@ -40,7 +40,7 @@ func NewCreateSymlinksHook(logger *logrus.Logger, csvFiles []string, mounts Disc d := symlinks{ logger: logger, lookup: lookup.NewExecutableLocator(logger, cfg.Root), - nvidiaCTKExecutablePath: cfg.NVIDIAContainerToolkitCLIExecutablePath, + nvidiaCTKExecutablePath: cfg.NvidiaCTKPath, csvFiles: csvFiles, mountsFrom: mounts, } diff --git a/internal/modifier/csv.go b/internal/modifier/csv.go index 57f8deea..b8217def 100644 --- a/internal/modifier/csv.go +++ b/internal/modifier/csv.go @@ -62,8 +62,8 @@ func NewCSVModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci.Spec) logger.Infof("Constructing modifier from config: %+v", *cfg) config := &discover.Config{ - Root: cfg.NVIDIAContainerCLIConfig.Root, - NVIDIAContainerToolkitCLIExecutablePath: cfg.NVIDIACTKConfig.Path, + Root: cfg.NVIDIAContainerCLIConfig.Root, + NvidiaCTKPath: cfg.NVIDIACTKConfig.Path, } if err := checkRequirements(logger, image); err != nil { diff --git a/internal/modifier/graphics.go b/internal/modifier/graphics.go index 76fec386..22e236de 100644 --- a/internal/modifier/graphics.go +++ b/internal/modifier/graphics.go @@ -45,8 +45,8 @@ func NewGraphicsModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci. } config := &discover.Config{ - Root: cfg.NVIDIAContainerCLIConfig.Root, - NVIDIAContainerToolkitCLIExecutablePath: cfg.NVIDIACTKConfig.Path, + Root: cfg.NVIDIAContainerCLIConfig.Root, + NvidiaCTKPath: cfg.NVIDIACTKConfig.Path, } d, err := discover.NewGraphicsDiscoverer( logger,