mirror of
https://github.com/containers/podman
synced 2024-10-21 09:45:32 +00:00
Remove GetStore function from Libpod
We should not be exposing the store outside of Libpod. We want to encapsulate it as an internal implementation detail - there's no reason functions outside of Libpod should directly be manipulating container storage. Convert the last use to invoke a method on Libpod instead, and remove the function. [NO TESTS NEEDED] as this is just a refactor. Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
parent
31c3b952e5
commit
e5fcffc551
|
@ -946,9 +946,12 @@ func (r *Runtime) StorageConfig() storage.StoreOptions {
|
||||||
return r.storageConfig
|
return r.storageConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStore returns the runtime stores
|
// RunRoot retrieves the current c/storage temporary directory in use by Libpod.
|
||||||
func (r *Runtime) GetStore() storage.Store {
|
func (r *Runtime) RunRoot() string {
|
||||||
return r.store
|
if r.store == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return r.store.RunRoot()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetName retrieves the name associated with a given full ID.
|
// GetName retrieves the name associated with a given full ID.
|
||||||
|
|
|
@ -160,16 +160,11 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
|
||||||
|
|
||||||
nameOrID, serviceName := containerServiceName(ctr, options)
|
nameOrID, serviceName := containerServiceName(ctr, options)
|
||||||
|
|
||||||
store := ctr.Runtime().GetStore()
|
|
||||||
if store == nil {
|
|
||||||
return nil, errors.Errorf("could not determine storage store for container")
|
|
||||||
}
|
|
||||||
|
|
||||||
var runRoot string
|
var runRoot string
|
||||||
if options.New {
|
if options.New {
|
||||||
runRoot = "%t/containers"
|
runRoot = "%t/containers"
|
||||||
} else {
|
} else {
|
||||||
runRoot = store.RunRoot()
|
runRoot = ctr.Runtime().RunRoot()
|
||||||
if runRoot == "" {
|
if runRoot == "" {
|
||||||
return nil, errors.Errorf("could not lookup container's runroot: got empty string")
|
return nil, errors.Errorf("could not lookup container's runroot: got empty string")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue