From a10fdb3808a7f505fa3d5ab8847bb3af610f3b47 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Fri, 14 Apr 2023 17:39:20 -0600 Subject: [PATCH] Remove config.DataStore() Comments in the code were already disparaging of config.DataStore(), but implied that its presence made other code more readable. It was only used in two places and, imo, how I've refactored it is more explicit and clear than it was. Signed-off-by: Jonathon Anderson --- internal/pkg/config/datastructure.go | 7 ------- internal/pkg/container/imprt.go | 2 +- internal/pkg/oci/defaults.go | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/internal/pkg/config/datastructure.go b/internal/pkg/config/datastructure.go index 92ada6ee..4d5cefd1 100644 --- a/internal/pkg/config/datastructure.go +++ b/internal/pkg/config/datastructure.go @@ -59,10 +59,3 @@ func (s *NfsConf) Unmarshal(unmarshal func(interface{}) error) error { } return nil } - -// Waste processor cycles to make code more readable - -func DataStore() string { - _ = Get() - return cachedConf.Warewulf.DataStore -} diff --git a/internal/pkg/container/imprt.go b/internal/pkg/container/imprt.go index 620991e7..2f62b438 100644 --- a/internal/pkg/container/imprt.go +++ b/internal/pkg/container/imprt.go @@ -15,7 +15,7 @@ import ( ) func ImportDocker(uri string, name string, sCtx *types.SystemContext) error { - OciBlobCacheDir := warewulfconf.DataStore() + "/oci" + OciBlobCacheDir := warewulfconf.Get().Warewulf.DataStore + "/oci" err := os.MkdirAll(OciBlobCacheDir, 0755) if err != nil { diff --git a/internal/pkg/oci/defaults.go b/internal/pkg/oci/defaults.go index 74bfb859..f7158a6f 100644 --- a/internal/pkg/oci/defaults.go +++ b/internal/pkg/oci/defaults.go @@ -5,7 +5,7 @@ import ( "path/filepath" ) -var defaultCachePath = filepath.Join(warewulfconf.DataStore(), "/container-cache/oci/") +var defaultCachePath = filepath.Join(warewulfconf.Get().Warewulf.DataStore, "/container-cache/oci/") const ( blobPrefix = "blobs"