diff options
Diffstat (limited to 'pkg/domain/infra/tunnel')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 120 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/events.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/generate.go | 4 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/healthcheck.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/images.go | 36 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/manifest.go | 10 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/network.go | 12 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/play.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/pods.go | 42 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/runtime.go | 6 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/system.go | 8 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/volumes.go | 14 |
12 files changed, 129 insertions, 129 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index ad8394675..7704de210 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -30,12 +30,12 @@ func (ic *ContainerEngine) ContainerRunlabel(ctx context.Context, label string, } func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrID string, options entities.ContainerExistsOptions) (*entities.BoolReport, error) { - exists, err := containers.Exists(ic.ClientCxt, nameOrID, options.External) + exists, err := containers.Exists(ic.ClientCtx, nameOrID, options.External) return &entities.BoolReport{Value: exists}, err } func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []string, opts entities.WaitOptions) ([]entities.WaitReport, error) { - cons, err := getContainersByContext(ic.ClientCxt, false, false, namesOrIds) + cons, err := getContainersByContext(ic.ClientCtx, false, false, namesOrIds) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []strin options := new(containers.WaitOptions).WithCondition(opts.Condition) for _, c := range cons { response := entities.WaitReport{Id: c.ID} - exitCode, err := containers.Wait(ic.ClientCxt, c.ID, options) + exitCode, err := containers.Wait(ic.ClientCtx, c.ID, options) if err != nil { response.Error = err } else { @@ -55,26 +55,26 @@ func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []strin } func (ic *ContainerEngine) ContainerPause(ctx context.Context, namesOrIds []string, options entities.PauseUnPauseOptions) ([]*entities.PauseUnpauseReport, error) { - ctrs, err := getContainersByContext(ic.ClientCxt, options.All, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, options.All, false, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PauseUnpauseReport, 0, len(ctrs)) for _, c := range ctrs { - err := containers.Pause(ic.ClientCxt, c.ID, nil) + err := containers.Pause(ic.ClientCtx, c.ID, nil) reports = append(reports, &entities.PauseUnpauseReport{Id: c.ID, Err: err}) } return reports, nil } func (ic *ContainerEngine) ContainerUnpause(ctx context.Context, namesOrIds []string, options entities.PauseUnPauseOptions) ([]*entities.PauseUnpauseReport, error) { - ctrs, err := getContainersByContext(ic.ClientCxt, options.All, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, options.All, false, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PauseUnpauseReport, 0, len(ctrs)) for _, c := range ctrs { - err := containers.Unpause(ic.ClientCxt, c.ID, nil) + err := containers.Unpause(ic.ClientCtx, c.ID, nil) reports = append(reports, &entities.PauseUnpauseReport{Id: c.ID, Err: err}) } return reports, nil @@ -90,7 +90,7 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin id := strings.Split(string(content), "\n")[0] namesOrIds = append(namesOrIds, id) } - ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, opts.Ignore, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, opts.Ignore, namesOrIds) if err != nil { return nil, err } @@ -100,7 +100,7 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin } for _, c := range ctrs { report := entities.StopReport{Id: c.ID} - if err = containers.Stop(ic.ClientCxt, c.ID, options); err != nil { + if err = containers.Stop(ic.ClientCtx, c.ID, options); err != nil { // These first two are considered non-fatal under the right conditions if errors.Cause(err).Error() == define.ErrCtrStopped.Error() { logrus.Debugf("Container %s is already stopped", c.ID) @@ -125,7 +125,7 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin } func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []string, opts entities.KillOptions) ([]*entities.KillReport, error) { - ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, false, namesOrIds) if err != nil { return nil, err } @@ -133,7 +133,7 @@ func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []strin for _, c := range ctrs { reports = append(reports, &entities.KillReport{ Id: c.ID, - Err: containers.Kill(ic.ClientCxt, c.ID, opts.Signal, nil), + Err: containers.Kill(ic.ClientCtx, c.ID, opts.Signal, nil), }) } return reports, nil @@ -147,7 +147,7 @@ func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []st if to := opts.Timeout; to != nil { options.WithTimeout(int(*to)) } - ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, false, namesOrIds) if err != nil { return nil, err } @@ -157,7 +157,7 @@ func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []st } reports = append(reports, &entities.RestartReport{ Id: c.ID, - Err: containers.Restart(ic.ClientCxt, c.ID, options), + Err: containers.Restart(ic.ClientCtx, c.ID, options), }) } return reports, nil @@ -172,7 +172,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, id := strings.Split(string(content), "\n")[0] namesOrIds = append(namesOrIds, id) } - ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, opts.Ignore, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, opts.Ignore, namesOrIds) if err != nil { return nil, err } @@ -182,7 +182,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, for _, c := range ctrs { reports = append(reports, &entities.RmReport{ Id: c.ID, - Err: containers.Remove(ic.ClientCxt, c.ID, options), + Err: containers.Remove(ic.ClientCtx, c.ID, options), }) } return reports, nil @@ -190,7 +190,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, func (ic *ContainerEngine) ContainerPrune(ctx context.Context, opts entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) { options := new(containers.PruneOptions).WithFilters(opts.Filters) - return containers.Prune(ic.ClientCxt, options) + return containers.Prune(ic.ClientCtx, options) } func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []string, opts entities.InspectOptions) ([]*entities.ContainerInspectReport, []error, error) { @@ -200,7 +200,7 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st ) options := new(containers.InspectOptions).WithSize(opts.Size) for _, name := range namesOrIds { - inspect, err := containers.Inspect(ic.ClientCxt, name, options) + inspect, err := containers.Inspect(ic.ClientCtx, name, options) if err != nil { errModel, ok := err.(entities.ErrorModel) if !ok { @@ -225,7 +225,7 @@ func (ic *ContainerEngine) ContainerTop(ctx context.Context, opts entities.TopOp return nil, errors.New("NameOrID must be specified") } options := new(containers.TopOptions).WithDescriptors(opts.Descriptors) - topOutput, err := containers.Top(ic.ClientCxt, opts.NameOrID, options) + topOutput, err := containers.Top(ic.ClientCtx, opts.NameOrID, options) if err != nil { return nil, err } @@ -254,7 +254,7 @@ func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, } options := new(containers.CommitOptions).WithAuthor(opts.Author).WithChanges(opts.Changes).WithComment(opts.Message) options.WithFormat(opts.Format).WithPause(opts.Pause).WithRepo(repo).WithTag(tag) - response, err := containers.Commit(ic.ClientCxt, nameOrID, options) + response, err := containers.Commit(ic.ClientCtx, nameOrID, options) if err != nil { return nil, err } @@ -272,7 +272,7 @@ func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrID string, return err } } - return containers.Export(ic.ClientCxt, nameOrID, w, nil) + return containers.Export(ic.ClientCtx, nameOrID, w, nil) } func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds []string, opts entities.CheckpointOptions) ([]*entities.CheckpointReport, error) { @@ -282,7 +282,7 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [ ) if opts.All { - allCtrs, err := getContainersByContext(ic.ClientCxt, true, false, []string{}) + allCtrs, err := getContainersByContext(ic.ClientCtx, true, false, []string{}) if err != nil { return nil, err } @@ -294,7 +294,7 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [ } } else { - ctrs, err = getContainersByContext(ic.ClientCxt, false, false, namesOrIds) + ctrs, err = getContainersByContext(ic.ClientCtx, false, false, namesOrIds) if err != nil { return nil, err } @@ -303,7 +303,7 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [ options := new(containers.CheckpointOptions).WithExport(opts.Export).WithIgnoreRootfs(opts.IgnoreRootFS).WithKeep(opts.Keep) options.WithLeaveRunning(opts.LeaveRunning).WithTCPEstablished(opts.TCPEstablished) for _, c := range ctrs { - report, err := containers.Checkpoint(ic.ClientCxt, c.ID, options) + report, err := containers.Checkpoint(ic.ClientCtx, c.ID, options) if err != nil { reports = append(reports, &entities.CheckpointReport{Id: c.ID, Err: err}) } @@ -318,7 +318,7 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st ctrs = []entities.ListContainer{} ) if opts.All { - allCtrs, err := getContainersByContext(ic.ClientCxt, true, false, []string{}) + allCtrs, err := getContainersByContext(ic.ClientCtx, true, false, []string{}) if err != nil { return nil, err } @@ -330,7 +330,7 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st } } else { - ctrs, err = getContainersByContext(ic.ClientCxt, false, false, namesOrIds) + ctrs, err = getContainersByContext(ic.ClientCtx, false, false, namesOrIds) if err != nil { return nil, err } @@ -338,7 +338,7 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st reports := make([]*entities.RestoreReport, 0, len(ctrs)) options := new(containers.RestoreOptions) for _, c := range ctrs { - report, err := containers.Restore(ic.ClientCxt, c.ID, options) + report, err := containers.Restore(ic.ClientCtx, c.ID, options) if err != nil { reports = append(reports, &entities.RestoreReport{Id: c.ID, Err: err}) } @@ -348,7 +348,7 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st } func (ic *ContainerEngine) ContainerCreate(ctx context.Context, s *specgen.SpecGenerator) (*entities.ContainerCreateReport, error) { - response, err := containers.CreateWithSpec(ic.ClientCxt, s, nil) + response, err := containers.CreateWithSpec(ic.ClientCtx, s, nil) if err != nil { return nil, err } @@ -371,7 +371,7 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, stderrCh := make(chan string) ctx, cancel := context.WithCancel(context.Background()) go func() { - err = containers.Logs(ic.ClientCxt, nameOrIDs[0], options, stdoutCh, stderrCh) + err = containers.Logs(ic.ClientCtx, nameOrIDs[0], options, stdoutCh, stderrCh) cancel() }() @@ -392,7 +392,7 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, } func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, opts entities.AttachOptions) error { - ctrs, err := getContainersByContext(ic.ClientCxt, false, false, []string{nameOrID}) + ctrs, err := getContainersByContext(ic.ClientCtx, false, false, []string{nameOrID}) if err != nil { return err } @@ -401,7 +401,7 @@ func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, return errors.Errorf("you can only attach to running containers") } options := new(containers.AttachOptions).WithStream(true).WithDetachKeys(opts.DetachKeys) - return containers.Attach(ic.ClientCxt, nameOrID, opts.Stdin, opts.Stdout, opts.Stderr, nil, options) + return containers.Attach(ic.ClientCtx, nameOrID, opts.Stdin, opts.Stdout, opts.Stderr, nil, options) } func makeExecConfig(options entities.ExecOptions) *handlers.ExecCreateConfig { @@ -429,7 +429,7 @@ func makeExecConfig(options entities.ExecOptions) *handlers.ExecCreateConfig { func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrID string, options entities.ExecOptions, streams define.AttachStreams) (int, error) { createConfig := makeExecConfig(options) - sessionID, err := containers.ExecCreate(ic.ClientCxt, nameOrID, createConfig) + sessionID, err := containers.ExecCreate(ic.ClientCtx, nameOrID, createConfig) if err != nil { return 125, err } @@ -439,11 +439,11 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrID string, o startAndAttachOptions.WithInputStream(*streams.InputStream) } startAndAttachOptions.WithAttachError(streams.AttachError).WithAttachOutput(streams.AttachOutput).WithAttachInput(streams.AttachInput) - if err := containers.ExecStartAndAttach(ic.ClientCxt, sessionID, startAndAttachOptions); err != nil { + if err := containers.ExecStartAndAttach(ic.ClientCtx, sessionID, startAndAttachOptions); err != nil { return 125, err } - inspectOut, err := containers.ExecInspect(ic.ClientCxt, sessionID, nil) + inspectOut, err := containers.ExecInspect(ic.ClientCtx, sessionID, nil) if err != nil { return 125, err } @@ -454,12 +454,12 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrID string, o func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrID string, options entities.ExecOptions) (string, error) { createConfig := makeExecConfig(options) - sessionID, err := containers.ExecCreate(ic.ClientCxt, nameOrID, createConfig) + sessionID, err := containers.ExecCreate(ic.ClientCtx, nameOrID, createConfig) if err != nil { return "", err } - if err := containers.ExecStart(ic.ClientCxt, sessionID, nil); err != nil { + if err := containers.ExecStart(ic.ClientCtx, sessionID, nil); err != nil { return "", err } @@ -474,7 +474,7 @@ func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, options.WithDetachKeys(*dk) } go func() { - err := containers.Attach(ic.ClientCxt, name, input, output, errput, attachReady, options) + err := containers.Attach(ic.ClientCtx, name, input, output, errput, attachReady, options) attachErr <- err }() // Wait for the attach to actually happen before starting @@ -485,7 +485,7 @@ func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, if dk := detachKeys; dk != nil { startOptions.WithDetachKeys(*dk) } - if err := containers.Start(ic.ClientCxt, name, startOptions); err != nil { + if err := containers.Start(ic.ClientCtx, name, startOptions); err != nil { return err } case err := <-attachErr: @@ -498,7 +498,7 @@ func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []string, options entities.ContainerStartOptions) ([]*entities.ContainerStartReport, error) { reports := []*entities.ContainerStartReport{} var exitCode = define.ExecErrorCodeGeneric - ctrs, err := getContainersByContext(ic.ClientCxt, false, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, false, false, namesOrIds) if err != nil { return nil, err } @@ -535,14 +535,14 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri // Defer the removal, so we can return early if needed and // de-spaghetti the code. defer func() { - shouldRestart, err := containers.ShouldRestart(ic.ClientCxt, ctr.ID, nil) + shouldRestart, err := containers.ShouldRestart(ic.ClientCtx, ctr.ID, nil) if err != nil { logrus.Errorf("Failed to check if %s should restart: %v", ctr.ID, err) return } if !shouldRestart { - if err := containers.Remove(ic.ClientCxt, ctr.ID, removeOptions); err != nil { + if err := containers.Remove(ic.ClientCtx, ctr.ID, removeOptions); err != nil { if errorhandling.Contains(err, define.ErrNoSuchCtr) || errorhandling.Contains(err, define.ErrCtrRemoved) { logrus.Warnf("Container %s does not exist: %v", ctr.ID, err) @@ -554,7 +554,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri }() } - exitCode, err := containers.Wait(ic.ClientCxt, name, nil) + exitCode, err := containers.Wait(ic.ClientCtx, name, nil) if err == define.ErrNoSuchCtr { // Check events event, err := ic.GetLastContainerEvent(ctx, name, events.Exited) @@ -573,11 +573,11 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri // Start the container if it's not running already. if !ctrRunning { - err = containers.Start(ic.ClientCxt, name, new(containers.StartOptions).WithDetachKeys(options.DetachKeys)) + err = containers.Start(ic.ClientCtx, name, new(containers.StartOptions).WithDetachKeys(options.DetachKeys)) if err != nil { if ctr.AutoRemove { rmOptions := new(containers.RemoveOptions).WithForce(false).WithVolumes(true) - if err := containers.Remove(ic.ClientCxt, ctr.ID, rmOptions); err != nil { + if err := containers.Remove(ic.ClientCtx, ctr.ID, rmOptions); err != nil { if errorhandling.Contains(err, define.ErrNoSuchCtr) || errorhandling.Contains(err, define.ErrCtrRemoved) { logrus.Warnf("Container %s does not exist: %v", ctr.ID, err) @@ -601,11 +601,11 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri func (ic *ContainerEngine) ContainerList(ctx context.Context, opts entities.ContainerListOptions) ([]entities.ListContainer, error) { options := new(containers.ListOptions).WithFilters(opts.Filters).WithAll(opts.All).WithLast(opts.Last) options.WithNamespace(opts.Namespace).WithSize(opts.Size).WithSync(opts.Sync) - return containers.List(ic.ClientCxt, options) + return containers.List(ic.ClientCtx, options) } func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.ContainerRunOptions) (*entities.ContainerRunReport, error) { - con, err := containers.CreateWithSpec(ic.ClientCxt, opts.Spec, nil) + con, err := containers.CreateWithSpec(ic.ClientCtx, opts.Spec, nil) if err != nil { return nil, err } @@ -622,7 +622,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta if opts.Detach { // Detach and return early - err := containers.Start(ic.ClientCxt, con.ID, nil) + err := containers.Start(ic.ClientCtx, con.ID, nil) if err != nil { report.ExitCode = define.ExitCode(err) } @@ -637,7 +637,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta report.ExitCode = define.ExitCode(err) if opts.Rm { - if rmErr := containers.Remove(ic.ClientCxt, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); rmErr != nil { + if rmErr := containers.Remove(ic.ClientCtx, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); rmErr != nil { logrus.Debugf("unable to remove container %s after failing to start and attach to it", con.ID) } } @@ -648,14 +648,14 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta // Defer the removal, so we can return early if needed and // de-spaghetti the code. defer func() { - shouldRestart, err := containers.ShouldRestart(ic.ClientCxt, con.ID, nil) + shouldRestart, err := containers.ShouldRestart(ic.ClientCtx, con.ID, nil) if err != nil { logrus.Errorf("Failed to check if %s should restart: %v", con.ID, err) return } if !shouldRestart { - if err := containers.Remove(ic.ClientCxt, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); err != nil { + if err := containers.Remove(ic.ClientCtx, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); err != nil { if errorhandling.Contains(err, define.ErrNoSuchCtr) || errorhandling.Contains(err, define.ErrCtrRemoved) { logrus.Warnf("Container %s does not exist: %v", con.ID, err) @@ -668,7 +668,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta } // Wait - exitCode, waitErr := containers.Wait(ic.ClientCxt, con.ID, nil) + exitCode, waitErr := containers.Wait(ic.ClientCtx, con.ID, nil) if waitErr == nil { report.ExitCode = int(exitCode) return &report, nil @@ -717,7 +717,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta } func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrID string, _ entities.DiffOptions) (*entities.DiffReport, error) { - changes, err := containers.Diff(ic.ClientCxt, nameOrID, nil) + changes, err := containers.Diff(ic.ClientCtx, nameOrID, nil) return &entities.DiffReport{Changes: changes}, err } @@ -726,13 +726,13 @@ func (ic *ContainerEngine) ContainerCleanup(ctx context.Context, namesOrIds []st } func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []string, options entities.ContainerInitOptions) ([]*entities.ContainerInitReport, error) { - ctrs, err := getContainersByContext(ic.ClientCxt, options.All, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, options.All, false, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.ContainerInitReport, 0, len(ctrs)) for _, ctr := range ctrs { - err := containers.ContainerInit(ic.ClientCxt, ctr.ID, nil) + err := containers.ContainerInit(ic.ClientCtx, ctr.ID, nil) // When using all, it is NOT considered an error if a container // has already been init'd. if err != nil && options.All && strings.Contains(errors.Cause(err).Error(), define.ErrCtrStateInvalid.Error()) { @@ -766,7 +766,7 @@ func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrID string, o if len(nameOrID) > 0 { namesOrIds = append(namesOrIds, nameOrID) } - ctrs, err := getContainersByContext(ic.ClientCxt, options.All, false, namesOrIds) + ctrs, err := getContainersByContext(ic.ClientCtx, options.All, false, namesOrIds) if err != nil { return nil, err } @@ -785,15 +785,15 @@ func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrID string, o } func (ic *ContainerEngine) ContainerCopyFromArchive(ctx context.Context, nameOrID string, path string, reader io.Reader) (entities.ContainerCopyFunc, error) { - return containers.CopyFromArchive(ic.ClientCxt, nameOrID, path, reader) + return containers.CopyFromArchive(ic.ClientCtx, nameOrID, path, reader) } func (ic *ContainerEngine) ContainerCopyToArchive(ctx context.Context, nameOrID string, path string, writer io.Writer) (entities.ContainerCopyFunc, error) { - return containers.CopyToArchive(ic.ClientCxt, nameOrID, path, writer) + return containers.CopyToArchive(ic.ClientCtx, nameOrID, path, writer) } func (ic *ContainerEngine) ContainerStat(ctx context.Context, nameOrID string, path string) (*entities.ContainerStatReport, error) { - return containers.Stat(ic.ClientCxt, nameOrID, path) + return containers.Stat(ic.ClientCtx, nameOrID, path) } // Shutdown Libpod engine @@ -804,10 +804,10 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri if options.Latest { return nil, errors.New("latest is not supported for the remote client") } - return containers.Stats(ic.ClientCxt, namesOrIds, new(containers.StatsOptions).WithStream(options.Stream)) + return containers.Stats(ic.ClientCtx, namesOrIds, new(containers.StatsOptions).WithStream(options.Stream)) } -// ShouldRestart reports back whether the containre will restart +// ShouldRestart reports back whether the container will restart func (ic *ContainerEngine) ShouldRestart(_ context.Context, id string) (bool, error) { - return containers.ShouldRestart(ic.ClientCxt, id, nil) + return containers.ShouldRestart(ic.ClientCtx, id, nil) } diff --git a/pkg/domain/infra/tunnel/events.go b/pkg/domain/infra/tunnel/events.go index 1254e04f3..cec6c749c 100644 --- a/pkg/domain/infra/tunnel/events.go +++ b/pkg/domain/infra/tunnel/events.go @@ -29,7 +29,7 @@ func (ic *ContainerEngine) Events(ctx context.Context, opts entities.EventsOptio close(opts.EventChan) }() options := new(system.EventsOptions).WithFilters(filters).WithSince(opts.Since).WithStream(opts.Stream).WithUntil(opts.Until) - return system.Events(ic.ClientCxt, binChan, nil, options) + return system.Events(ic.ClientCtx, binChan, nil, options) } // GetLastContainerEvent takes a container name or ID and an event status and returns diff --git a/pkg/domain/infra/tunnel/generate.go b/pkg/domain/infra/tunnel/generate.go index 30a501a48..6d68157c1 100644 --- a/pkg/domain/infra/tunnel/generate.go +++ b/pkg/domain/infra/tunnel/generate.go @@ -13,10 +13,10 @@ func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string, if to := opts.StopTimeout; to != nil { options.WithStopTimeout(*opts.StopTimeout) } - return generate.Systemd(ic.ClientCxt, nameOrID, options) + return generate.Systemd(ic.ClientCtx, nameOrID, options) } func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrIDs []string, opts entities.GenerateKubeOptions) (*entities.GenerateKubeReport, error) { options := new(generate.KubeOptions).WithService(opts.Service) - return generate.Kube(ic.ClientCxt, nameOrIDs, options) + return generate.Kube(ic.ClientCtx, nameOrIDs, options) } diff --git a/pkg/domain/infra/tunnel/healthcheck.go b/pkg/domain/infra/tunnel/healthcheck.go index b3ff888d8..3daf22647 100644 --- a/pkg/domain/infra/tunnel/healthcheck.go +++ b/pkg/domain/infra/tunnel/healthcheck.go @@ -9,5 +9,5 @@ import ( ) func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) { - return containers.RunHealthCheck(ic.ClientCxt, nameOrID, nil) + return containers.RunHealthCheck(ic.ClientCtx, nameOrID, nil) } diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index 99291962f..10bf9682c 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -22,13 +22,13 @@ import ( ) func (ir *ImageEngine) Exists(_ context.Context, nameOrID string) (*entities.BoolReport, error) { - found, err := images.Exists(ir.ClientCxt, nameOrID) + found, err := images.Exists(ir.ClientCtx, nameOrID) return &entities.BoolReport{Value: found}, err } func (ir *ImageEngine) Remove(ctx context.Context, imagesArg []string, opts entities.ImageRemoveOptions) (*entities.ImageRemoveReport, []error) { options := new(images.RemoveOptions).WithForce(opts.Force).WithAll(opts.All) - return images.Remove(ir.ClientCxt, imagesArg, options) + return images.Remove(ir.ClientCtx, imagesArg, options) } func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) ([]*entities.ImageSummary, error) { @@ -39,7 +39,7 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) filters[f[0]] = f[1:] } options := new(images.ListOptions).WithAll(opts.All).WithFilters(filters) - psImages, err := images.List(ir.ClientCxt, options) + psImages, err := images.List(ir.ClientCtx, options) if err != nil { return nil, err } @@ -65,7 +65,7 @@ func (ir *ImageEngine) Unmount(ctx context.Context, images []string, options ent func (ir *ImageEngine) History(ctx context.Context, nameOrID string, opts entities.ImageHistoryOptions) (*entities.ImageHistoryReport, error) { options := new(images.HistoryOptions) - results, err := images.History(ir.ClientCxt, nameOrID, options) + results, err := images.History(ir.ClientCtx, nameOrID, options) if err != nil { return nil, err } @@ -97,7 +97,7 @@ func (ir *ImageEngine) Prune(ctx context.Context, opts entities.ImagePruneOption filters[f[0]] = f[1:] } options := new(images.PruneOptions).WithAll(opts.All).WithFilters(filters) - results, err := images.Prune(ir.ClientCxt, options) + results, err := images.Prune(ir.ClientCtx, options) if err != nil { return nil, err } @@ -124,7 +124,7 @@ func (ir *ImageEngine) Pull(ctx context.Context, rawImage string, opts entities. } } options.WithQuiet(opts.Quiet).WithSignaturePolicy(opts.SignaturePolicy).WithUsername(opts.Username) - pulledImages, err := images.Pull(ir.ClientCxt, rawImage, options) + pulledImages, err := images.Pull(ir.ClientCtx, rawImage, options) if err != nil { return nil, err } @@ -150,7 +150,7 @@ func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, if len(repo) < 1 { return errors.Errorf("invalid image name %q", nameOrID) } - if err := images.Tag(ir.ClientCxt, nameOrID, tag, repo, options); err != nil { + if err := images.Tag(ir.ClientCtx, nameOrID, tag, repo, options); err != nil { return err } } @@ -160,7 +160,7 @@ func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, func (ir *ImageEngine) Untag(ctx context.Context, nameOrID string, tags []string, opt entities.ImageUntagOptions) error { options := new(images.UntagOptions) if len(tags) == 0 { - return images.Untag(ir.ClientCxt, nameOrID, "", "", options) + return images.Untag(ir.ClientCtx, nameOrID, "", "", options) } for _, newTag := range tags { @@ -180,7 +180,7 @@ func (ir *ImageEngine) Untag(ctx context.Context, nameOrID string, tags []string if len(repo) < 1 { return errors.Errorf("invalid image name %q", nameOrID) } - if err := images.Untag(ir.ClientCxt, nameOrID, tag, repo, options); err != nil { + if err := images.Untag(ir.ClientCtx, nameOrID, tag, repo, options); err != nil { return err } } @@ -192,7 +192,7 @@ func (ir *ImageEngine) Inspect(ctx context.Context, namesOrIDs []string, opts en reports := []*entities.ImageInspectReport{} errs := []error{} for _, i := range namesOrIDs { - r, err := images.GetImage(ir.ClientCxt, i, options) + r, err := images.GetImage(ir.ClientCtx, i, options) if err != nil { errModel, ok := err.(entities.ErrorModel) if !ok { @@ -227,7 +227,7 @@ func (ir *ImageEngine) Load(ctx context.Context, opts entities.ImageLoadOptions) ref += ":" + opts.Tag } options := new(images.LoadOptions).WithReference(ref) - return images.Load(ir.ClientCxt, f, options) + return images.Load(ir.ClientCtx, f, options) } func (ir *ImageEngine) Import(ctx context.Context, opts entities.ImageImportOptions) (*entities.ImageImportReport, error) { @@ -244,7 +244,7 @@ func (ir *ImageEngine) Import(ctx context.Context, opts entities.ImageImportOpti return nil, err } } - return images.Import(ir.ClientCxt, f, options) + return images.Import(ir.ClientCtx, f, options) } func (ir *ImageEngine) Push(ctx context.Context, source string, destination string, opts entities.ImagePushOptions) error { @@ -261,7 +261,7 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri options.WithSkipTLSVerify(false) } } - return images.Push(ir.ClientCxt, source, destination, options) + return images.Push(ir.ClientCtx, source, destination, options) } func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string, opts entities.ImageSaveOptions) error { @@ -284,7 +284,7 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string, return err } - exErr := images.Export(ir.ClientCxt, append([]string{nameOrID}, tags...), f, options) + exErr := images.Export(ir.ClientCtx, append([]string{nameOrID}, tags...), f, options) if err := f.Close(); err != nil { return err } @@ -319,7 +319,7 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string, // Diff reports the changes to the given image func (ir *ImageEngine) Diff(ctx context.Context, nameOrID string, _ entities.DiffOptions) (*entities.DiffReport, error) { options := new(images.DiffOptions) - changes, err := images.Diff(ir.ClientCxt, nameOrID, options) + changes, err := images.Diff(ir.ClientCtx, nameOrID, options) if err != nil { return nil, err } @@ -354,7 +354,7 @@ func (ir *ImageEngine) Search(ctx context.Context, term string, opts entities.Im options.WithSkipTLSVerify(false) } } - return images.Search(ir.ClientCxt, term, options) + return images.Search(ir.ClientCtx, term, options) } func (ir *ImageEngine) Config(_ context.Context) (*config.Config, error) { @@ -362,7 +362,7 @@ func (ir *ImageEngine) Config(_ context.Context) (*config.Config, error) { } func (ir *ImageEngine) Build(_ context.Context, containerFiles []string, opts entities.BuildOptions) (*entities.BuildReport, error) { - report, err := images.Build(ir.ClientCxt, containerFiles, opts) + report, err := images.Build(ir.ClientCtx, containerFiles, opts) if err != nil { return nil, err } @@ -382,7 +382,7 @@ func (ir *ImageEngine) Build(_ context.Context, containerFiles []string, opts en func (ir *ImageEngine) Tree(ctx context.Context, nameOrID string, opts entities.ImageTreeOptions) (*entities.ImageTreeReport, error) { options := new(images.TreeOptions).WithWhatRequires(opts.WhatRequires) - return images.Tree(ir.ClientCxt, nameOrID, options) + return images.Tree(ir.ClientCtx, nameOrID, options) } // Shutdown Libpod engine diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go index 97f79a92b..c71349fe0 100644 --- a/pkg/domain/infra/tunnel/manifest.go +++ b/pkg/domain/infra/tunnel/manifest.go @@ -14,7 +14,7 @@ import ( // ManifestCreate implements manifest create via ImageEngine func (ir *ImageEngine) ManifestCreate(ctx context.Context, names, images []string, opts entities.ManifestCreateOptions) (string, error) { options := new(manifests.CreateOptions).WithAll(opts.All) - imageID, err := manifests.Create(ir.ClientCxt, names, images, options) + imageID, err := manifests.Create(ir.ClientCtx, names, images, options) if err != nil { return imageID, errors.Wrapf(err, "error creating manifest") } @@ -23,7 +23,7 @@ func (ir *ImageEngine) ManifestCreate(ctx context.Context, names, images []strin // ManifestInspect returns contents of manifest list with given name func (ir *ImageEngine) ManifestInspect(ctx context.Context, name string) ([]byte, error) { - list, err := manifests.Inspect(ir.ClientCxt, name, nil) + list, err := manifests.Inspect(ir.ClientCtx, name, nil) if err != nil { return nil, errors.Wrapf(err, "error getting content of manifest list or image %s", name) } @@ -51,7 +51,7 @@ func (ir *ImageEngine) ManifestAdd(ctx context.Context, opts entities.ManifestAd options.WithAnnotation(annotations) } - listID, err := manifests.Add(ir.ClientCxt, opts.Images[1], options) + listID, err := manifests.Add(ir.ClientCtx, opts.Images[1], options) if err != nil { return listID, errors.Wrapf(err, "error adding to manifest list %s", opts.Images[1]) } @@ -65,7 +65,7 @@ func (ir *ImageEngine) ManifestAnnotate(ctx context.Context, names []string, opt // ManifestRemove removes the digest from manifest list func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (string, error) { - updatedListID, err := manifests.Remove(ir.ClientCxt, names[0], names[1], nil) + updatedListID, err := manifests.Remove(ir.ClientCtx, names[0], names[1], nil) if err != nil { return updatedListID, errors.Wrapf(err, "error removing from manifest %s", names[0]) } @@ -75,6 +75,6 @@ func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (stri // ManifestPush pushes a manifest list or image index to the destination func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination string, opts entities.ManifestPushOptions) error { options := new(manifests.PushOptions).WithAll(opts.All) - _, err := manifests.Push(ir.ClientCxt, name, destination, options) + _, err := manifests.Push(ir.ClientCtx, name, destination, options) return err } diff --git a/pkg/domain/infra/tunnel/network.go b/pkg/domain/infra/tunnel/network.go index 6391e501f..9afb8db02 100644 --- a/pkg/domain/infra/tunnel/network.go +++ b/pkg/domain/infra/tunnel/network.go @@ -10,7 +10,7 @@ import ( func (ic *ContainerEngine) NetworkList(ctx context.Context, opts entities.NetworkListOptions) ([]*entities.NetworkListReport, error) { options := new(network.ListOptions).WithFilters(opts.Filters) - return network.List(ic.ClientCxt, options) + return network.List(ic.ClientCtx, options) } func (ic *ContainerEngine) NetworkInspect(ctx context.Context, namesOrIds []string, opts entities.InspectOptions) ([]entities.NetworkInspectReport, []error, error) { @@ -20,7 +20,7 @@ func (ic *ContainerEngine) NetworkInspect(ctx context.Context, namesOrIds []stri ) options := new(network.InspectOptions) for _, name := range namesOrIds { - report, err := network.Inspect(ic.ClientCxt, name, options) + report, err := network.Inspect(ic.ClientCtx, name, options) if err != nil { errModel, ok := err.(entities.ErrorModel) if !ok { @@ -45,7 +45,7 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o reports := make([]*entities.NetworkRmReport, 0, len(namesOrIds)) options := new(network.RemoveOptions).WithForce(opts.Force) for _, name := range namesOrIds { - response, err := network.Remove(ic.ClientCxt, name, options) + response, err := network.Remove(ic.ClientCtx, name, options) if err != nil { report := &entities.NetworkRmReport{ Name: name, @@ -63,17 +63,17 @@ func (ic *ContainerEngine) NetworkCreate(ctx context.Context, name string, opts options := new(network.CreateOptions).WithName(name).WithDisableDNS(opts.DisableDNS).WithDriver(opts.Driver).WithGateway(opts.Gateway) options.WithInternal(opts.Internal).WithIPRange(opts.Range).WithIPv6(opts.IPv6).WithLabels(opts.Labels).WithIPv6(opts.IPv6) options.WithMacVLAN(opts.MacVLAN).WithOptions(opts.Options).WithSubnet(opts.Subnet) - return network.Create(ic.ClientCxt, options) + return network.Create(ic.ClientCtx, options) } // NetworkDisconnect removes a container from a given network func (ic *ContainerEngine) NetworkDisconnect(ctx context.Context, networkname string, opts entities.NetworkDisconnectOptions) error { options := new(network.DisconnectOptions).WithForce(opts.Force) - return network.Disconnect(ic.ClientCxt, networkname, opts.Container, options) + return network.Disconnect(ic.ClientCtx, networkname, opts.Container, options) } // NetworkConnect removes a container from a given network func (ic *ContainerEngine) NetworkConnect(ctx context.Context, networkname string, opts entities.NetworkConnectOptions) error { options := new(network.ConnectOptions).WithAliases(opts.Aliases) - return network.Connect(ic.ClientCxt, networkname, opts.Container, options) + return network.Connect(ic.ClientCtx, networkname, opts.Container, options) } diff --git a/pkg/domain/infra/tunnel/play.go b/pkg/domain/infra/tunnel/play.go index 5197e0d6c..2318b9caa 100644 --- a/pkg/domain/infra/tunnel/play.go +++ b/pkg/domain/infra/tunnel/play.go @@ -19,5 +19,5 @@ func (ic *ContainerEngine) PlayKube(ctx context.Context, path string, opts entit if start := opts.Start; start != types.OptionalBoolUndefined { options.WithStart(start == types.OptionalBoolTrue) } - return play.Kube(ic.ClientCxt, path, options) + return play.Kube(ic.ClientCtx, path, options) } diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go index 1ceff9ca7..aa7b92fa7 100644 --- a/pkg/domain/infra/tunnel/pods.go +++ b/pkg/domain/infra/tunnel/pods.go @@ -12,7 +12,7 @@ import ( ) func (ic *ContainerEngine) PodExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) { - exists, err := pods.Exists(ic.ClientCxt, nameOrID) + exists, err := pods.Exists(ic.ClientCtx, nameOrID) return &entities.BoolReport{Value: exists}, err } @@ -22,14 +22,14 @@ func (ic *ContainerEngine) PodKill(ctx context.Context, namesOrIds []string, opt return nil, err } - foundPods, err := getPodsByContext(ic.ClientCxt, opts.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, opts.All, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PodKillReport, 0, len(foundPods)) options := new(pods.KillOptions).WithSignal(opts.Signal) for _, p := range foundPods { - response, err := pods.Kill(ic.ClientCxt, p.Id, options) + response, err := pods.Kill(ic.ClientCtx, p.Id, options) if err != nil { report := entities.PodKillReport{ Errs: []error{err}, @@ -44,13 +44,13 @@ func (ic *ContainerEngine) PodKill(ctx context.Context, namesOrIds []string, opt } func (ic *ContainerEngine) PodPause(ctx context.Context, namesOrIds []string, options entities.PodPauseOptions) ([]*entities.PodPauseReport, error) { - foundPods, err := getPodsByContext(ic.ClientCxt, options.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, options.All, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PodPauseReport, 0, len(foundPods)) for _, p := range foundPods { - response, err := pods.Pause(ic.ClientCxt, p.Id, nil) + response, err := pods.Pause(ic.ClientCtx, p.Id, nil) if err != nil { report := entities.PodPauseReport{ Errs: []error{err}, @@ -65,13 +65,13 @@ func (ic *ContainerEngine) PodPause(ctx context.Context, namesOrIds []string, op } func (ic *ContainerEngine) PodUnpause(ctx context.Context, namesOrIds []string, options entities.PodunpauseOptions) ([]*entities.PodUnpauseReport, error) { - foundPods, err := getPodsByContext(ic.ClientCxt, options.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, options.All, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PodUnpauseReport, 0, len(foundPods)) for _, p := range foundPods { - response, err := pods.Unpause(ic.ClientCxt, p.Id, nil) + response, err := pods.Unpause(ic.ClientCtx, p.Id, nil) if err != nil { report := entities.PodUnpauseReport{ Errs: []error{err}, @@ -87,7 +87,7 @@ func (ic *ContainerEngine) PodUnpause(ctx context.Context, namesOrIds []string, func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, opts entities.PodStopOptions) ([]*entities.PodStopReport, error) { timeout := -1 - foundPods, err := getPodsByContext(ic.ClientCxt, opts.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, opts.All, namesOrIds) if err != nil && !(opts.Ignore && errors.Cause(err) == define.ErrNoSuchPod) { return nil, err } @@ -97,7 +97,7 @@ func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, opt reports := make([]*entities.PodStopReport, 0, len(foundPods)) options := new(pods.StopOptions).WithTimeout(timeout) for _, p := range foundPods { - response, err := pods.Stop(ic.ClientCxt, p.Id, options) + response, err := pods.Stop(ic.ClientCtx, p.Id, options) if err != nil { report := entities.PodStopReport{ Errs: []error{err}, @@ -112,13 +112,13 @@ func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, opt } func (ic *ContainerEngine) PodRestart(ctx context.Context, namesOrIds []string, options entities.PodRestartOptions) ([]*entities.PodRestartReport, error) { - foundPods, err := getPodsByContext(ic.ClientCxt, options.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, options.All, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PodRestartReport, 0, len(foundPods)) for _, p := range foundPods { - response, err := pods.Restart(ic.ClientCxt, p.Id, nil) + response, err := pods.Restart(ic.ClientCtx, p.Id, nil) if err != nil { report := entities.PodRestartReport{ Errs: []error{err}, @@ -133,13 +133,13 @@ func (ic *ContainerEngine) PodRestart(ctx context.Context, namesOrIds []string, } func (ic *ContainerEngine) PodStart(ctx context.Context, namesOrIds []string, options entities.PodStartOptions) ([]*entities.PodStartReport, error) { - foundPods, err := getPodsByContext(ic.ClientCxt, options.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, options.All, namesOrIds) if err != nil { return nil, err } reports := make([]*entities.PodStartReport, 0, len(foundPods)) for _, p := range foundPods { - response, err := pods.Start(ic.ClientCxt, p.Id, nil) + response, err := pods.Start(ic.ClientCtx, p.Id, nil) if err != nil { report := entities.PodStartReport{ Errs: []error{err}, @@ -154,14 +154,14 @@ func (ic *ContainerEngine) PodStart(ctx context.Context, namesOrIds []string, op } func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, opts entities.PodRmOptions) ([]*entities.PodRmReport, error) { - foundPods, err := getPodsByContext(ic.ClientCxt, opts.All, namesOrIds) + foundPods, err := getPodsByContext(ic.ClientCtx, opts.All, namesOrIds) if err != nil && !(opts.Ignore && errors.Cause(err) == define.ErrNoSuchPod) { return nil, err } reports := make([]*entities.PodRmReport, 0, len(foundPods)) options := new(pods.RemoveOptions).WithForce(opts.Force) for _, p := range foundPods { - response, err := pods.Remove(ic.ClientCxt, p.Id, options) + response, err := pods.Remove(ic.ClientCtx, p.Id, options) if err != nil { report := entities.PodRmReport{ Err: err, @@ -176,13 +176,13 @@ func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, opts } func (ic *ContainerEngine) PodPrune(ctx context.Context, opts entities.PodPruneOptions) ([]*entities.PodPruneReport, error) { - return pods.Prune(ic.ClientCxt, nil) + return pods.Prune(ic.ClientCtx, nil) } func (ic *ContainerEngine) PodCreate(ctx context.Context, opts entities.PodCreateOptions) (*entities.PodCreateReport, error) { podSpec := specgen.NewPodSpecGenerator() opts.ToPodSpecGen(podSpec) - return pods.CreatePodFromSpec(ic.ClientCxt, podSpec, nil) + return pods.CreatePodFromSpec(ic.ClientCtx, podSpec, nil) } func (ic *ContainerEngine) PodTop(ctx context.Context, opts entities.PodTopOptions) (*entities.StringSliceReport, error) { @@ -193,7 +193,7 @@ func (ic *ContainerEngine) PodTop(ctx context.Context, opts entities.PodTopOptio return nil, errors.New("NameOrID must be specified") } options := new(pods.TopOptions).WithDescriptors(opts.Descriptors) - topOutput, err := pods.Top(ic.ClientCxt, opts.NameOrID, options) + topOutput, err := pods.Top(ic.ClientCtx, opts.NameOrID, options) if err != nil { return nil, err } @@ -202,7 +202,7 @@ func (ic *ContainerEngine) PodTop(ctx context.Context, opts entities.PodTopOptio func (ic *ContainerEngine) PodPs(ctx context.Context, opts entities.PodPSOptions) ([]*entities.ListPodsReport, error) { options := new(pods.ListOptions).WithFilters(opts.Filters) - return pods.List(ic.ClientCxt, options) + return pods.List(ic.ClientCtx, options) } func (ic *ContainerEngine) PodInspect(ctx context.Context, options entities.PodInspectOptions) (*entities.PodInspectReport, error) { @@ -212,10 +212,10 @@ func (ic *ContainerEngine) PodInspect(ctx context.Context, options entities.PodI case options.NameOrID == "": return nil, errors.New("NameOrID must be specified") } - return pods.Inspect(ic.ClientCxt, options.NameOrID, nil) + return pods.Inspect(ic.ClientCtx, options.NameOrID, nil) } func (ic *ContainerEngine) PodStats(ctx context.Context, namesOrIds []string, opts entities.PodStatsOptions) ([]*entities.PodStatsReport, error) { options := new(pods.StatsOptions).WithAll(opts.All) - return pods.Stats(ic.ClientCxt, namesOrIds, options) + return pods.Stats(ic.ClientCtx, namesOrIds, options) } diff --git a/pkg/domain/infra/tunnel/runtime.go b/pkg/domain/infra/tunnel/runtime.go index 357e2c390..6542ea5b7 100644 --- a/pkg/domain/infra/tunnel/runtime.go +++ b/pkg/domain/infra/tunnel/runtime.go @@ -6,15 +6,15 @@ import ( // Image-related runtime using an ssh-tunnel to utilize Podman service type ImageEngine struct { - ClientCxt context.Context + ClientCtx context.Context } // Container-related runtime using an ssh-tunnel to utilize Podman service type ContainerEngine struct { - ClientCxt context.Context + ClientCtx context.Context } // Container-related runtime using an ssh-tunnel to utilize Podman service type SystemEngine struct { - ClientCxt context.Context + ClientCtx context.Context } diff --git a/pkg/domain/infra/tunnel/system.go b/pkg/domain/infra/tunnel/system.go index 9013d44c2..a46b164a5 100644 --- a/pkg/domain/infra/tunnel/system.go +++ b/pkg/domain/infra/tunnel/system.go @@ -11,7 +11,7 @@ import ( ) func (ic *ContainerEngine) Info(ctx context.Context) (*define.Info, error) { - return system.Info(ic.ClientCxt, nil) + return system.Info(ic.ClientCtx, nil) } func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command) error { @@ -21,11 +21,11 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command) // SystemPrune prunes unused data from the system. func (ic *ContainerEngine) SystemPrune(ctx context.Context, opts entities.SystemPruneOptions) (*entities.SystemPruneReport, error) { options := new(system.PruneOptions).WithAll(opts.All).WithVolumes(opts.Volume).WithFilters(opts.Filters) - return system.Prune(ic.ClientCxt, options) + return system.Prune(ic.ClientCtx, options) } func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.SystemDfOptions) (*entities.SystemDfReport, error) { - return system.DiskUsage(ic.ClientCxt, nil) + return system.DiskUsage(ic.ClientCtx, nil) } func (ic *ContainerEngine) Unshare(ctx context.Context, args []string) error { @@ -33,5 +33,5 @@ func (ic *ContainerEngine) Unshare(ctx context.Context, args []string) error { } func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) { - return system.Version(ic.ClientCxt, nil) + return system.Version(ic.ClientCtx, nil) } diff --git a/pkg/domain/infra/tunnel/volumes.go b/pkg/domain/infra/tunnel/volumes.go index 9f8aa6356..e6ad4e0c5 100644 --- a/pkg/domain/infra/tunnel/volumes.go +++ b/pkg/domain/infra/tunnel/volumes.go @@ -9,7 +9,7 @@ import ( ) func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.VolumeCreateOptions) (*entities.IDOrNameResponse, error) { - response, err := volumes.Create(ic.ClientCxt, opts, nil) + response, err := volumes.Create(ic.ClientCtx, opts, nil) if err != nil { return nil, err } @@ -18,7 +18,7 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) { if opts.All { - vols, err := volumes.List(ic.ClientCxt, nil) + vols, err := volumes.List(ic.ClientCtx, nil) if err != nil { return nil, err } @@ -30,7 +30,7 @@ func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, op for _, id := range namesOrIds { options := new(volumes.RemoveOptions).WithForce(opts.Force) reports = append(reports, &entities.VolumeRmReport{ - Err: volumes.Remove(ic.ClientCxt, id, options), + Err: volumes.Remove(ic.ClientCtx, id, options), Id: id, }) } @@ -43,7 +43,7 @@ func (ic *ContainerEngine) VolumeInspect(ctx context.Context, namesOrIds []strin errs = []error{} ) if opts.All { - vols, err := volumes.List(ic.ClientCxt, nil) + vols, err := volumes.List(ic.ClientCtx, nil) if err != nil { return nil, nil, err } @@ -52,7 +52,7 @@ func (ic *ContainerEngine) VolumeInspect(ctx context.Context, namesOrIds []strin } } for _, id := range namesOrIds { - data, err := volumes.Inspect(ic.ClientCxt, id, nil) + data, err := volumes.Inspect(ic.ClientCtx, id, nil) if err != nil { errModel, ok := err.(entities.ErrorModel) if !ok { @@ -71,10 +71,10 @@ func (ic *ContainerEngine) VolumeInspect(ctx context.Context, namesOrIds []strin func (ic *ContainerEngine) VolumePrune(ctx context.Context, opts entities.VolumePruneOptions) ([]*entities.VolumePruneReport, error) { options := new(volumes.PruneOptions).WithFilters(opts.Filters) - return volumes.Prune(ic.ClientCxt, options) + return volumes.Prune(ic.ClientCtx, options) } func (ic *ContainerEngine) VolumeList(ctx context.Context, opts entities.VolumeListOptions) ([]*entities.VolumeListReport, error) { options := new(volumes.ListOptions).WithFilters(opts.Filter) - return volumes.List(ic.ClientCxt, options) + return volumes.List(ic.ClientCtx, options) } |