mirror of https://github.com/containers/podman.git
cmd/podman: refactor Context handling
The PodmanOptionsKey is never used anywhere so it is pointless to add
this. Second having several functions to return the same context makes
no sense so fold them all into one. Lastly create the context once and
always return the same one instead of having to nil check each time.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 34de0feda5)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
11ef179de2
commit
e50898e1f7
|
|
@ -43,7 +43,7 @@ func init() {
|
||||||
|
|
||||||
func inspect(cmd *cobra.Command, args []string) error {
|
func inspect(cmd *cobra.Command, args []string) error {
|
||||||
artifactOptions := entities.ArtifactInspectOptions{}
|
artifactOptions := entities.ArtifactInspectOptions{}
|
||||||
inspectData, err := registry.ImageEngine().ArtifactInspect(registry.GetContext(), args[0], artifactOptions)
|
inspectData, err := registry.ImageEngine().ArtifactInspect(registry.Context(), args[0], artifactOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func list(cmd *cobra.Command, _ []string) error {
|
func list(cmd *cobra.Command, _ []string) error {
|
||||||
reports, err := registry.ImageEngine().ArtifactList(registry.GetContext(), entities.ArtifactListOptions{})
|
reports, err := registry.ImageEngine().ArtifactList(registry.Context(), entities.ArtifactListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,6 @@ func artifactPull(cmd *cobra.Command, args []string) error {
|
||||||
pullOptions.Writer = os.Stdout
|
pullOptions.Writer = os.Stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = registry.ImageEngine().ArtifactPull(registry.GetContext(), args[0], pullOptions.ArtifactPullOptions)
|
_, err = registry.ImageEngine().ArtifactPull(registry.Context(), args[0], pullOptions.ArtifactPullOptions)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,6 @@ func artifactPush(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_, err = registry.ImageEngine().ArtifactPush(registry.GetContext(), source, pushOptions.ArtifactPushOptions)
|
_, err = registry.ImageEngine().ArtifactPush(registry.Context(), source, pushOptions.ArtifactPushOptions)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func rm(cmd *cobra.Command, args []string) error {
|
func rm(cmd *cobra.Command, args []string) error {
|
||||||
artifactRemoveReport, err := registry.ImageEngine().ArtifactRm(registry.GetContext(), args[0], entities.ArtifactRemoveOptions{})
|
artifactRemoveReport, err := registry.ImageEngine().ArtifactRm(registry.Context(), args[0], entities.ArtifactRemoveOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ func autoUpdate(cmd *cobra.Command, args []string) error {
|
||||||
autoUpdateOptions.InsecureSkipTLSVerify = types.NewOptionalBool(!autoUpdateOptions.tlsVerify)
|
autoUpdateOptions.InsecureSkipTLSVerify = types.NewOptionalBool(!autoUpdateOptions.tlsVerify)
|
||||||
}
|
}
|
||||||
|
|
||||||
allReports, failures := registry.ContainerEngine().AutoUpdate(registry.GetContext(), autoUpdateOptions.AutoUpdateOptions)
|
allReports, failures := registry.ContainerEngine().AutoUpdate(registry.Context(), autoUpdateOptions.AutoUpdateOptions)
|
||||||
if allReports == nil {
|
if allReports == nil {
|
||||||
return errorhandling.JoinErrors(failures)
|
return errorhandling.JoinErrors(failures)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func getContainers(cmd *cobra.Command, toComplete string, cType completeType, st
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
containers, err := engine.ContainerList(registry.GetContext(), listOpts)
|
containers, err := engine.ContainerList(registry.Context(), listOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
@ -138,7 +138,7 @@ func getPods(cmd *cobra.Command, toComplete string, cType completeType, statuses
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
pods, err := engine.PodPs(registry.GetContext(), listOpts)
|
pods, err := engine.PodPs(registry.Context(), listOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
@ -168,7 +168,7 @@ func getVolumes(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCom
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
volumes, err := engine.VolumeList(registry.GetContext(), lsOpts)
|
volumes, err := engine.VolumeList(registry.Context(), lsOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
@ -191,7 +191,7 @@ func getImages(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellComp
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
images, err := engine.List(registry.GetContext(), listOptions)
|
images, err := engine.List(registry.Context(), listOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
@ -235,7 +235,7 @@ func getManifestListMembers(cmd *cobra.Command, list, toComplete string) ([]stri
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
listData, err := engine.ManifestInspect(registry.GetContext(), list, inspectOptions)
|
listData, err := engine.ManifestInspect(registry.Context(), list, inspectOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
@ -257,7 +257,7 @@ func getSecrets(cmd *cobra.Command, toComplete string, cType completeType) ([]st
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
secrets, err := engine.SecretList(registry.GetContext(), entities.SecretListRequest{})
|
secrets, err := engine.SecretList(registry.Context(), entities.SecretListRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
@ -327,7 +327,7 @@ func getArtifacts(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellC
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
artifacts, err := engine.ArtifactList(registry.GetContext(), listOptions)
|
artifacts, err := engine.ArtifactList(registry.Context(), listOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
|
||||||
|
|
@ -84,5 +84,5 @@ func attach(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
attachOpts.Stdout = os.Stdout
|
attachOpts.Stdout = os.Stdout
|
||||||
attachOpts.Stderr = os.Stderr
|
attachOpts.Stderr = os.Stderr
|
||||||
return registry.ContainerEngine().ContainerAttach(registry.GetContext(), name, attachOpts)
|
return registry.ContainerEngine().ContainerAttach(registry.Context(), name, attachOpts)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ func cleanup(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
responses, err := registry.ContainerEngine().ContainerCleanup(registry.GetContext(), args, cleanupOptions)
|
responses, err := registry.ContainerEngine().ContainerCleanup(registry.Context(), args, cleanupOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// `podman container cleanup` is almost always run in the
|
// `podman container cleanup` is almost always run in the
|
||||||
// background. Our only way of relaying information to the user
|
// background. Our only way of relaying information to the user
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ func clone(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
ctrClone.ID = args[0]
|
ctrClone.ID = args[0]
|
||||||
ctrClone.CreateOpts.IsClone = true
|
ctrClone.CreateOpts.IsClone = true
|
||||||
rep, err := registry.ContainerEngine().ContainerClone(registry.GetContext(), ctrClone)
|
rep, err := registry.ContainerEngine().ContainerClone(registry.Context(), ctrClone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ func cp(cmd *cobra.Command, args []string) error {
|
||||||
// containerMustExist returns an error if the specified container does not
|
// containerMustExist returns an error if the specified container does not
|
||||||
// exist.
|
// exist.
|
||||||
func containerMustExist(container string) error {
|
func containerMustExist(container string) error {
|
||||||
exists, err := registry.ContainerEngine().ContainerExists(registry.GetContext(), container, entities.ContainerExistsOptions{})
|
exists, err := registry.ContainerEngine().ContainerExists(registry.Context(), container, entities.ContainerExistsOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ func copyContainerToContainer(sourceContainer string, sourcePath string, destCon
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceContainerInfo, err := registry.ContainerEngine().ContainerStat(registry.GetContext(), sourceContainer, sourcePath)
|
sourceContainerInfo, err := registry.ContainerEngine().ContainerStat(registry.Context(), sourceContainer, sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%q could not be found on container %s: %w", sourcePath, sourceContainer, err)
|
return fmt.Errorf("%q could not be found on container %s: %w", sourcePath, sourceContainer, err)
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +166,7 @@ func copyContainerToContainer(sourceContainer string, sourcePath string, destCon
|
||||||
|
|
||||||
sourceContainerCopy := func() error {
|
sourceContainerCopy := func() error {
|
||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
copyFunc, err := registry.ContainerEngine().ContainerCopyToArchive(registry.GetContext(), sourceContainer, sourceContainerTarget, writer)
|
copyFunc, err := registry.ContainerEngine().ContainerCopyToArchive(registry.Context(), sourceContainer, sourceContainerTarget, writer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +186,7 @@ func copyContainerToContainer(sourceContainer string, sourcePath string, destCon
|
||||||
copyOptions.Rename = map[string]string{filepath.Base(sourceContainerTarget): destContainerBaseName}
|
copyOptions.Rename = map[string]string{filepath.Base(sourceContainerTarget): destContainerBaseName}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyFunc, err := registry.ContainerEngine().ContainerCopyFromArchive(registry.GetContext(), destContainer, destContainerTarget, reader, copyOptions)
|
copyFunc, err := registry.ContainerEngine().ContainerCopyFromArchive(registry.Context(), destContainer, destContainerTarget, reader, copyOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +211,7 @@ func copyFromContainer(container string, containerPath string, hostPath string)
|
||||||
hostPath = os.Stdout.Name()
|
hostPath = os.Stdout.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
containerInfo, err := registry.ContainerEngine().ContainerStat(registry.GetContext(), container, containerPath)
|
containerInfo, err := registry.ContainerEngine().ContainerStat(registry.Context(), container, containerPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%q could not be found on container %s: %w", containerPath, container, err)
|
return fmt.Errorf("%q could not be found on container %s: %w", containerPath, container, err)
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +321,7 @@ func copyFromContainer(container string, containerPath string, hostPath string)
|
||||||
|
|
||||||
containerCopy := func() error {
|
containerCopy := func() error {
|
||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
copyFunc, err := registry.ContainerEngine().ContainerCopyToArchive(registry.GetContext(), container, containerTarget, writer)
|
copyFunc, err := registry.ContainerEngine().ContainerCopyToArchive(registry.Context(), container, containerTarget, writer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -439,7 +439,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er
|
||||||
target = filepath.Dir(target)
|
target = filepath.Dir(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
copyFunc, err := registry.ContainerEngine().ContainerCopyFromArchive(registry.GetContext(), container, target, reader, entities.CopyOptions{Chown: chown, NoOverwriteDirNonDir: !cpOpts.OverwriteDirNonDir})
|
copyFunc, err := registry.ContainerEngine().ContainerCopyFromArchive(registry.Context(), container, target, reader, entities.CopyOptions{Chown: chown, NoOverwriteDirNonDir: !cpOpts.OverwriteDirNonDir})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -456,7 +456,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er
|
||||||
// container. If the path does not exist, it attempts to use the parent
|
// container. If the path does not exist, it attempts to use the parent
|
||||||
// directory.
|
// directory.
|
||||||
func resolvePathOnDestinationContainer(container string, containerPath string, isStdin bool) (baseName string, containerInfo *entities.ContainerStatReport, resolvedToParentDir bool, err error) {
|
func resolvePathOnDestinationContainer(container string, containerPath string, isStdin bool) (baseName string, containerInfo *entities.ContainerStatReport, resolvedToParentDir bool, err error) {
|
||||||
containerInfo, err = registry.ContainerEngine().ContainerStat(registry.GetContext(), container, containerPath)
|
containerInfo, err = registry.ContainerEngine().ContainerStat(registry.Context(), container, containerPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
baseName = filepath.Base(containerInfo.LinkTarget)
|
baseName = filepath.Base(containerInfo.LinkTarget)
|
||||||
return //nolint: nilerr
|
return //nolint: nilerr
|
||||||
|
|
@ -488,7 +488,7 @@ func resolvePathOnDestinationContainer(container string, containerPath string, i
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
containerInfo, err = registry.ContainerEngine().ContainerStat(registry.GetContext(), container, parentDir)
|
containerInfo, err = registry.ContainerEngine().ContainerStat(registry.Context(), container, parentDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("%q could not be found on container %s: %w", containerPath, container, err)
|
err = fmt.Errorf("%q could not be found on container %s: %w", containerPath, container, err)
|
||||||
return
|
return
|
||||||
|
|
@ -505,7 +505,7 @@ func containerParentDir(container string, containerPath string) (string, error)
|
||||||
if filepath.IsAbs(containerPath) {
|
if filepath.IsAbs(containerPath) {
|
||||||
return filepath.Dir(containerPath), nil
|
return filepath.Dir(containerPath), nil
|
||||||
}
|
}
|
||||||
inspectData, _, err := registry.ContainerEngine().ContainerInspect(registry.GetContext(), []string{container}, entities.InspectOptions{})
|
inspectData, _, err := registry.ContainerEngine().ContainerInspect(registry.Context(), []string{container}, entities.InspectOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ func create(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
report, err := registry.ContainerEngine().ContainerCreate(registry.GetContext(), s)
|
report, err := registry.ContainerEngine().ContainerCreate(registry.Context(), s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if pod was created as part of run
|
// if pod was created as part of run
|
||||||
// remove it in case ctr creation fails
|
// remove it in case ctr creation fails
|
||||||
|
|
@ -401,7 +401,7 @@ func pullImage(cmd *cobra.Command, imageName string, cliVals *entities.Container
|
||||||
pullOptions.RetryDelay = val
|
pullOptions.RetryDelay = val
|
||||||
}
|
}
|
||||||
|
|
||||||
pullReport, pullErr := registry.ImageEngine().Pull(registry.GetContext(), imageName, pullOptions)
|
pullReport, pullErr := registry.ImageEngine().Pull(registry.Context(), imageName, pullOptions)
|
||||||
if pullErr != nil {
|
if pullErr != nil {
|
||||||
return "", pullErr
|
return "", pullErr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -178,12 +178,12 @@ func exec(cmd *cobra.Command, args []string) error {
|
||||||
streams.AttachOutput = true
|
streams.AttachOutput = true
|
||||||
streams.AttachError = true
|
streams.AttachError = true
|
||||||
|
|
||||||
exitCode, err := registry.ContainerEngine().ContainerExec(registry.GetContext(), nameOrID, execOpts, streams)
|
exitCode, err := registry.ContainerEngine().ContainerExec(registry.Context(), nameOrID, execOpts, streams)
|
||||||
registry.SetExitCode(exitCode)
|
registry.SetExitCode(exitCode)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := registry.ContainerEngine().ContainerExecDetached(registry.GetContext(), nameOrID, execOpts)
|
id, err := registry.ContainerEngine().ContainerExecDetached(registry.Context(), nameOrID, execOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ func init() {
|
||||||
func initContainer(cmd *cobra.Command, args []string) error {
|
func initContainer(cmd *cobra.Command, args []string) error {
|
||||||
var errs utils.OutputErrors
|
var errs utils.OutputErrors
|
||||||
args = utils.RemoveSlash(args)
|
args = utils.RemoveSlash(args)
|
||||||
report, err := registry.ContainerEngine().ContainerInit(registry.GetContext(), args, initOptions)
|
report, err := registry.ContainerEngine().ContainerInit(registry.Context(), args, initOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,5 +142,5 @@ func logs(_ *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
logsOptions.StdoutWriter = os.Stdout
|
logsOptions.StdoutWriter = os.Stdout
|
||||||
logsOptions.StderrWriter = os.Stderr
|
logsOptions.StderrWriter = os.Stderr
|
||||||
return registry.ContainerEngine().ContainerLogs(registry.GetContext(), args, logsOptions.ContainerLogsOptions)
|
return registry.ContainerEngine().ContainerLogs(registry.Context(), args, logsOptions.ContainerLogsOptions)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ func mount(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
args = utils.RemoveSlash(args)
|
args = utils.RemoveSlash(args)
|
||||||
|
|
||||||
reports, err := registry.ContainerEngine().ContainerMount(registry.GetContext(), args, mountOpts)
|
reports, err := registry.ContainerEngine().ContainerMount(registry.Context(), args, mountOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ func port(_ *cobra.Command, args []string) error {
|
||||||
userProto = fields[1]
|
userProto = fields[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
reports, err := registry.ContainerEngine().ContainerPort(registry.GetContext(), container, portOpts)
|
reports, err := registry.ContainerEngine().ContainerPort(registry.Context(), container, portOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ func quietOut(responses []entities.ListContainer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getResponses() ([]entities.ListContainer, error) {
|
func getResponses() ([]entities.ListContainer, error) {
|
||||||
responses, err := registry.ContainerEngine().ContainerList(registry.GetContext(), listOpts)
|
responses, err := registry.ContainerEngine().ContainerList(registry.Context(), listOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,5 +52,5 @@ func rename(cmd *cobra.Command, args []string) error {
|
||||||
renameOpts := entities.ContainerRenameOptions{
|
renameOpts := entities.ContainerRenameOptions{
|
||||||
NewName: args[1],
|
NewName: args[1],
|
||||||
}
|
}
|
||||||
return registry.ContainerEngine().ContainerRename(registry.GetContext(), args[0], renameOpts)
|
return registry.ContainerEngine().ContainerRename(registry.Context(), args[0], renameOpts)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ func restore(cmd *cobra.Command, args []string) error {
|
||||||
// Check if the container exists (#15055)
|
// Check if the container exists (#15055)
|
||||||
exists := &entities.BoolReport{Value: false}
|
exists := &entities.BoolReport{Value: false}
|
||||||
for _, ctr := range args {
|
for _, ctr := range args {
|
||||||
exists, e = registry.ContainerEngine().ContainerExists(registry.GetContext(), ctr, entities.ContainerExistsOptions{})
|
exists, e = registry.ContainerEngine().ContainerExists(registry.Context(), ctr, entities.ContainerExistsOptions{})
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ func run(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
report, err := registry.ContainerEngine().ContainerRun(registry.GetContext(), runOpts)
|
report, err := registry.ContainerEngine().ContainerRun(registry.Context(), runOpts)
|
||||||
// report.ExitCode is set by ContainerRun even it returns an error
|
// report.ExitCode is set by ContainerRun even it returns an error
|
||||||
if report != nil {
|
if report != nil {
|
||||||
registry.SetExitCode(report.ExitCode)
|
registry.SetExitCode(report.ExitCode)
|
||||||
|
|
@ -248,7 +248,7 @@ func run(cmd *cobra.Command, args []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if runRmi {
|
if runRmi {
|
||||||
_, rmErrors := registry.ImageEngine().Remove(registry.GetContext(), []string{imageName}, entities.ImageRemoveOptions{Ignore: true})
|
_, rmErrors := registry.ImageEngine().Remove(registry.Context(), []string{imageName}, entities.ImageRemoveOptions{Ignore: true})
|
||||||
for _, err := range rmErrors {
|
for _, err := range rmErrors {
|
||||||
logrus.Warnf("Failed to remove image: %v", err)
|
logrus.Warnf("Failed to remove image: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ func start(cmd *cobra.Command, args []string) error {
|
||||||
startOptions.Filters[fname] = append(startOptions.Filters[fname], filter)
|
startOptions.Filters[fname] = append(startOptions.Filters[fname], filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
responses, err := registry.ContainerEngine().ContainerStart(registry.GetContext(), containers, startOptions)
|
responses, err := registry.ContainerEngine().ContainerStart(registry.Context(), containers, startOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func init() {
|
||||||
func unmount(cmd *cobra.Command, args []string) error {
|
func unmount(cmd *cobra.Command, args []string) error {
|
||||||
var errs utils.OutputErrors
|
var errs utils.OutputErrors
|
||||||
args = utils.RemoveSlash(args)
|
args = utils.RemoveSlash(args)
|
||||||
reports, err := registry.ContainerEngine().ContainerUnmount(registry.GetContext(), args, unmountOpts)
|
reports, err := registry.ContainerEngine().ContainerUnmount(registry.Context(), args, unmountOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Diff(_ *cobra.Command, args []string, options entities.DiffOptions) error {
|
func Diff(_ *cobra.Command, args []string, options entities.DiffOptions) error {
|
||||||
results, err := registry.ContainerEngine().Diff(registry.GetContext(), args, options)
|
results, err := registry.ContainerEngine().Diff(registry.Context(), args, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func init() {
|
||||||
|
|
||||||
func spec(cmd *cobra.Command, args []string) error {
|
func spec(cmd *cobra.Command, args []string) error {
|
||||||
opts.ID = args[0]
|
opts.ID = args[0]
|
||||||
report, err := registry.ContainerEngine().GenerateSpec(registry.GetContext(), opts)
|
report, err := registry.ContainerEngine().GenerateSpec(registry.Context(), opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ func systemd(cmd *cobra.Command, args []string) error {
|
||||||
return fmt.Errorf("%s and %s are redundant and cannot be used together", stopTimeoutFlagName, stopTimeoutCompatFlagName)
|
return fmt.Errorf("%s and %s are redundant and cannot be used together", stopTimeoutFlagName, stopTimeoutCompatFlagName)
|
||||||
}
|
}
|
||||||
|
|
||||||
reports, err := registry.ContainerEngine().GenerateSystemd(registry.GetContext(), args[0], systemdOptions)
|
reports, err := registry.ContainerEngine().GenerateSystemd(registry.Context(), args[0], systemdOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ func build(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
report, err := registry.ImageEngine().Build(registry.GetContext(), apiBuildOpts.ContainerFiles, *apiBuildOpts)
|
report, err := registry.ImageEngine().Build(registry.Context(), apiBuildOpts.ContainerFiles, *apiBuildOpts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitCode := buildahCLI.ExecErrorCodeGeneric
|
exitCode := buildahCLI.ExecErrorCodeGeneric
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func exists(cmd *cobra.Command, args []string) error {
|
func exists(cmd *cobra.Command, args []string) error {
|
||||||
found, err := registry.ImageEngine().Exists(registry.GetContext(), args[0])
|
found, err := registry.ImageEngine().Exists(registry.Context(), args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ func images(cmd *cobra.Command, args []string) error {
|
||||||
listFlag.sort, sortFields.String())
|
listFlag.sort, sortFields.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
summaries, err := registry.ImageEngine().List(registry.GetContext(), listOptions)
|
summaries, err := registry.ImageEngine().List(registry.Context(), listOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func mount(cmd *cobra.Command, args []string) error {
|
||||||
return errors.New("when using the --all switch, you may not pass any image names or IDs")
|
return errors.New("when using the --all switch, you may not pass any image names or IDs")
|
||||||
}
|
}
|
||||||
|
|
||||||
reports, err := registry.ImageEngine().Mount(registry.GetContext(), args, mountOpts)
|
reports, err := registry.ImageEngine().Mount(registry.Context(), args, mountOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func prune(cmd *cobra.Command, args []string) error {
|
||||||
pruneOpts.Filter = append(pruneOpts.Filter, fmt.Sprintf("%s=%s", k, val))
|
pruneOpts.Filter = append(pruneOpts.Filter, fmt.Sprintf("%s=%s", k, val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results, err := registry.ImageEngine().Prune(registry.GetContext(), pruneOpts)
|
results, err := registry.ImageEngine().Prune(registry.Context(), pruneOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ func imagePull(cmd *cobra.Command, args []string) error {
|
||||||
// scattering logic across (too) many parts of the code.
|
// scattering logic across (too) many parts of the code.
|
||||||
var errs utils.OutputErrors
|
var errs utils.OutputErrors
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), arg, pullOptions.ImagePullOptions)
|
pullReport, err := registry.ImageEngine().Pull(registry.Context(), arg, pullOptions.ImagePullOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ func imagePush(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
// Let's do all the remaining Yoga in the API to prevent us from scattering
|
// Let's do all the remaining Yoga in the API to prevent us from scattering
|
||||||
// logic across (too) many parts of the code.
|
// logic across (too) many parts of the code.
|
||||||
report, err := registry.ImageEngine().Push(registry.GetContext(), source, destination, pushOptions.ImagePushOptions)
|
report, err := registry.ImageEngine().Push(registry.Context(), source, destination, pushOptions.ImagePushOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ func rm(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
// Note: certain image-removal errors are non-fatal. Hence, the report
|
// Note: certain image-removal errors are non-fatal. Hence, the report
|
||||||
// might be set even if err != nil.
|
// might be set even if err != nil.
|
||||||
report, rmErrors := registry.ImageEngine().Remove(registry.GetContext(), args, imageOpts)
|
report, rmErrors := registry.ImageEngine().Remove(registry.Context(), args, imageOpts)
|
||||||
if report != nil {
|
if report != nil {
|
||||||
for _, u := range report.Untagged {
|
for _, u := range report.Untagged {
|
||||||
fmt.Println("Untagged: " + u)
|
fmt.Println("Untagged: " + u)
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ func imageSearch(cmd *cobra.Command, args []string) error {
|
||||||
searchOptions.Password = creds.Password
|
searchOptions.Password = creds.Password
|
||||||
}
|
}
|
||||||
|
|
||||||
searchReport, err := registry.ImageEngine().Search(registry.GetContext(), searchTerm, searchOptions.ImageSearchOptions)
|
searchReport, err := registry.ImageEngine().Search(registry.Context(), searchTerm, searchOptions.ImageSearchOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,5 +45,5 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func tag(cmd *cobra.Command, args []string) error {
|
func tag(cmd *cobra.Command, args []string) error {
|
||||||
return registry.ImageEngine().Tag(registry.GetContext(), args[0], args[1:], entities.ImageTagOptions{})
|
return registry.ImageEngine().Tag(registry.Context(), args[0], args[1:], entities.ImageTagOptions{})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func unmount(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) > 0 && unmountOpts.All {
|
if len(args) > 0 && unmountOpts.All {
|
||||||
return errors.New("when using the --all switch, you may not pass any image names or IDs")
|
return errors.New("when using the --all switch, you may not pass any image names or IDs")
|
||||||
}
|
}
|
||||||
reports, err := registry.ImageEngine().Unmount(registry.GetContext(), args, unmountOpts)
|
reports, err := registry.ImageEngine().Unmount(registry.Context(), args, unmountOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,5 +44,5 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func untag(cmd *cobra.Command, args []string) error {
|
func untag(cmd *cobra.Command, args []string) error {
|
||||||
return registry.ImageEngine().Untag(registry.GetContext(), args[0], args[1:], entities.ImageUntagOptions{})
|
return registry.ImageEngine().Untag(registry.Context(), args[0], args[1:], entities.ImageUntagOptions{})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ func apply(cmd *cobra.Command, args []string) error {
|
||||||
reader = f
|
reader = f
|
||||||
} else {
|
} else {
|
||||||
generateOptions.Service = applyOptions.Service
|
generateOptions.Service = applyOptions.Service
|
||||||
report, err := registry.ContainerEngine().GenerateKube(registry.GetContext(), args, generateOptions)
|
report, err := registry.ContainerEngine().GenerateKube(registry.Context(), args, generateOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ func apply(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
fmt.Println("Deploying to cluster...")
|
fmt.Println("Deploying to cluster...")
|
||||||
|
|
||||||
if err = registry.ContainerEngine().KubeApply(registry.GetContext(), reader, applyOptions); err != nil {
|
if err = registry.ContainerEngine().KubeApply(registry.Context(), reader, applyOptions); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ func generateFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateKube(cmd *cobra.Command, args []string) error {
|
func generateKube(cmd *cobra.Command, args []string) error {
|
||||||
report, err := registry.ContainerEngine().GenerateKube(registry.GetContext(), args, generateOptions)
|
report, err := registry.ContainerEngine().GenerateKube(registry.Context(), args, generateOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ func teardown(body io.Reader, options entities.PlayKubeDownOptions) error {
|
||||||
volRmErrors utils.OutputErrors
|
volRmErrors utils.OutputErrors
|
||||||
secRmErrors utils.OutputErrors
|
secRmErrors utils.OutputErrors
|
||||||
)
|
)
|
||||||
reports, err := registry.ContainerEngine().PlayKubeDown(registry.GetContext(), body, options)
|
reports, err := registry.ContainerEngine().PlayKubeDown(registry.Context(), body, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -465,7 +465,7 @@ func teardown(body io.Reader, options entities.PlayKubeDownOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func kubeplay(body io.Reader) error {
|
func kubeplay(body io.Reader) error {
|
||||||
report, err := registry.ContainerEngine().PlayKube(registry.GetContext(), body, playOptions.PlayKubeOptions)
|
report, err := registry.ContainerEngine().PlayKube(registry.Context(), body, playOptions.PlayKubeOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -478,7 +478,7 @@ func kubeplay(body io.Reader) error {
|
||||||
|
|
||||||
// If --wait=true, we need wait for the service container to exit so that we know that the pod has exited and we can clean up
|
// If --wait=true, we need wait for the service container to exit so that we know that the pod has exited and we can clean up
|
||||||
if playOptions.Wait {
|
if playOptions.Wait {
|
||||||
_, err := registry.ContainerEngine().ContainerWait(registry.GetContext(), []string{report.ServiceContainerID}, entities.WaitOptions{})
|
_, err := registry.ContainerEngine().ContainerWait(registry.Context(), []string{report.ServiceContainerID}, entities.WaitOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func exists(cmd *cobra.Command, args []string) error {
|
func exists(cmd *cobra.Command, args []string) error {
|
||||||
found, err := registry.ImageEngine().ManifestExists(registry.GetContext(), args[0])
|
found, err := registry.ImageEngine().ManifestExists(registry.Context(), args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func networkExists(cmd *cobra.Command, args []string) error {
|
func networkExists(cmd *cobra.Command, args []string) error {
|
||||||
response, err := registry.ContainerEngine().NetworkExists(registry.GetContext(), args[0])
|
response, err := registry.ContainerEngine().NetworkExists(registry.Context(), args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,5 +126,5 @@ func logs(_ *cobra.Command, args []string) error {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
podName = args[0]
|
podName = args[0]
|
||||||
}
|
}
|
||||||
return registry.ContainerEngine().PodLogs(registry.GetContext(), podName, logsPodOptions.PodLogsOptions)
|
return registry.ContainerEngine().PodLogs(registry.Context(), podName, logsPodOptions.PodLogsOptions)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ type CliCommand struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cliCtx context.Context
|
cliCtx = context.Background()
|
||||||
containerEngine entities.ContainerEngine
|
containerEngine entities.ContainerEngine
|
||||||
exitCode = 0
|
exitCode = 0
|
||||||
imageEngine entities.ImageEngine
|
imageEngine entities.ImageEngine
|
||||||
|
|
@ -81,30 +81,10 @@ func NewContainerEngine(cmd *cobra.Command, args []string) (entities.ContainerEn
|
||||||
return containerEngine, nil
|
return containerEngine, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodmanOptionsKey struct{}
|
|
||||||
|
|
||||||
func Context() context.Context {
|
func Context() context.Context {
|
||||||
if cliCtx == nil {
|
|
||||||
cliCtx = ContextWithOptions(context.Background())
|
|
||||||
}
|
|
||||||
return cliCtx
|
return cliCtx
|
||||||
}
|
}
|
||||||
|
|
||||||
func ContextWithOptions(ctx context.Context) context.Context {
|
|
||||||
cliCtx = context.WithValue(ctx, PodmanOptionsKey{}, podmanOptions)
|
|
||||||
return cliCtx
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContextWithOptions deprecated, use NewContextWithOptions()
|
|
||||||
func GetContextWithOptions() context.Context {
|
|
||||||
return ContextWithOptions(context.Background())
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContext deprecated, use Context()
|
|
||||||
func GetContext() context.Context {
|
|
||||||
return Context()
|
|
||||||
}
|
|
||||||
|
|
||||||
func DefaultAPIAddress() string {
|
func DefaultAPIAddress() string {
|
||||||
if rootless.IsRootless() {
|
if rootless.IsRootless() {
|
||||||
xdg, err := util.GetRootlessRuntimeDir()
|
xdg, err := util.GetRootlessRuntimeDir()
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
if err := rootCmd.ExecuteContext(registry.GetContextWithOptions()); err != nil {
|
if err := rootCmd.ExecuteContext(registry.Context()); err != nil {
|
||||||
if registry.GetExitCode() == 0 {
|
if registry.GetExitCode() == 0 {
|
||||||
registry.SetExitCode(define.ExecErrorCodeGeneric)
|
registry.SetExitCode(define.ExecErrorCodeGeneric)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func exists(cmd *cobra.Command, args []string) error {
|
func exists(cmd *cobra.Command, args []string) error {
|
||||||
found, err := registry.ContainerEngine().SecretExists(registry.GetContext(), args[0])
|
found, err := registry.ContainerEngine().SecretExists(registry.Context(), args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ func infoFlags(cmd *cobra.Command) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func info(cmd *cobra.Command, args []string) error {
|
func info(cmd *cobra.Command, args []string) error {
|
||||||
info, err := registry.ContainerEngine().Info(registry.GetContext())
|
info, err := registry.ContainerEngine().Info(registry.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func volumeExists(cmd *cobra.Command, args []string) error {
|
func volumeExists(cmd *cobra.Command, args []string) error {
|
||||||
response, err := registry.ContainerEngine().VolumeExists(registry.GetContext(), args[0])
|
response, err := registry.ContainerEngine().VolumeExists(registry.Context(), args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ func init() {
|
||||||
|
|
||||||
func volumeMount(cmd *cobra.Command, args []string) error {
|
func volumeMount(cmd *cobra.Command, args []string) error {
|
||||||
var errs utils.OutputErrors
|
var errs utils.OutputErrors
|
||||||
reports, err := registry.ContainerEngine().VolumeMount(registry.GetContext(), args)
|
reports, err := registry.ContainerEngine().VolumeMount(registry.Context(), args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ func init() {
|
||||||
|
|
||||||
func volumeUnmount(cmd *cobra.Command, args []string) error {
|
func volumeUnmount(cmd *cobra.Command, args []string) error {
|
||||||
var errs utils.OutputErrors
|
var errs utils.OutputErrors
|
||||||
reports, err := registry.ContainerEngine().VolumeUnmount(registry.GetContext(), args)
|
reports, err := registry.ContainerEngine().VolumeUnmount(registry.Context(), args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue