diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-06-24 14:35:10 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-06-25 09:56:21 +0200 |
commit | f95b0995e521e252af52edaf57a31241d364e3d8 (patch) | |
tree | 438f53d11703722c6712cf1b84c9fe1efdc884d0 /libpod/runtime.go | |
parent | d1f57a07c24a0defc0b0027206fc4454307f64fa (diff) | |
download | podman-f95b0995e521e252af52edaf57a31241d364e3d8.tar.gz podman-f95b0995e521e252af52edaf57a31241d364e3d8.tar.bz2 podman-f95b0995e521e252af52edaf57a31241d364e3d8.zip |
remove `pkg/registries`
Pull the trigger on the `pkg/registries` package which acted as a proxy
for `c/image/pkg/sysregistriesv2`. Callers should be using the packages
from c/image directly, if needed at all.
Also make use of libimage's SystemContext() method which returns a copy
of a system context, further reducing the risk of unintentionally
altering global data.
[NO TESTS NEEDED]
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index f53789e89..d31d00ae4 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -29,7 +29,6 @@ import ( "github.com/containers/podman/v3/libpod/plugin" "github.com/containers/podman/v3/libpod/shutdown" "github.com/containers/podman/v3/pkg/cgroups" - "github.com/containers/podman/v3/pkg/registries" "github.com/containers/podman/v3/pkg/rootless" "github.com/containers/podman/v3/pkg/util" "github.com/containers/storage" @@ -932,7 +931,9 @@ func (r *Runtime) LibimageRuntime() *libimage.Runtime { // SystemContext returns the imagecontext func (r *Runtime) SystemContext() *types.SystemContext { - return r.imageContext + // Return the context from the libimage runtime. libimage is sensitive + // to a number of env vars. + return r.libimageRuntime.SystemContext() } // GetOCIRuntimePath retrieves the path of the default OCI runtime. @@ -1042,9 +1043,9 @@ func (r *Runtime) Reload() error { if err := r.reloadStorageConf(); err != nil { return err } - if err := reloadRegistriesConf(); err != nil { - return err - } + // Invalidate the registries.conf cache. The next invocation will + // reload all data. + sysregistriesv2.InvalidateCache() return nil } @@ -1059,17 +1060,6 @@ func (r *Runtime) reloadContainersConf() error { return nil } -// reloadRegistries reloads the registries.conf -func reloadRegistriesConf() error { - sysregistriesv2.InvalidateCache() - registries, err := sysregistriesv2.GetRegistries(&types.SystemContext{SystemRegistriesConfPath: registries.SystemRegistriesConfPath()}) - if err != nil { - return err - } - logrus.Infof("applied new registry configuration: %+v", registries) - return nil -} - // reloadStorageConf reloads the storage.conf func (r *Runtime) reloadStorageConf() error { configFile, err := storage.DefaultConfigFile(rootless.IsRootless()) |