From b0df7dd5e34047879d6698a46dd81b53259b90f7 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 13 Sep 2023 08:51:40 -0500 Subject: [PATCH] server/config: use filepath.Join() Signed-off-by: Dan Williams --- pkg/server/config/manager.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/server/config/manager.go b/pkg/server/config/manager.go index f5e1755c1..80a5d6c6b 100644 --- a/pkg/server/config/manager.go +++ b/pkg/server/config/manager.go @@ -91,7 +91,7 @@ func overrideCNIVersion(cniConfigFile string, multusCNIVersion string) error { func newManager(config MultusConf, defaultCNIPluginName string) (*Manager, error) { if config.ForceCNIVersion { - err := overrideCNIVersion(cniPluginConfigFilePath(config.MultusAutoconfigDir, defaultCNIPluginName), config.CNIVersion) + err := overrideCNIVersion(filepath.Join(config.MultusAutoconfigDir, defaultCNIPluginName), config.CNIVersion) if err != nil { return nil, err } @@ -115,8 +115,8 @@ func newManager(config MultusConf, defaultCNIPluginName string) (*Manager, error configWatcher: watcher, multusConfig: &config, multusConfigDir: config.MultusAutoconfigDir, - multusConfigFilePath: cniPluginConfigFilePath(config.CniConfigDir, multusConfigFileName), - primaryCNIConfigPath: cniPluginConfigFilePath(config.MultusAutoconfigDir, defaultCNIPluginName), + multusConfigFilePath: filepath.Join(config.CniConfigDir, multusConfigFileName), + primaryCNIConfigPath: filepath.Join(config.MultusAutoconfigDir, defaultCNIPluginName), readinessIndicatorFilePath: config.ReadinessIndicatorFile, } @@ -289,10 +289,6 @@ func getPrimaryCNIPluginName(multusAutoconfigDir string) (string, error) { return masterCniConfigFileName, nil } -func cniPluginConfigFilePath(cniConfigDir string, cniConfigFileName string) string { - return cniConfigDir + fmt.Sprintf("/%s", cniConfigFileName) -} - func newWatcher(cniConfigDir string, readinessIndicatorDir string) (*fsnotify.Watcher, error) { watcher, err := fsnotify.NewWatcher() if err != nil {