mirror of
https://github.com/containers/podman.git
synced 2025-12-03 15:45:12 +00:00
enable gofumpt formatter
Based on our discussion gofumpt won the vote so use that one via golangci-lint. https://github.com/containers/podman/discussions/27291 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@@ -4,7 +4,7 @@ run:
|
||||
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
exclusions:
|
||||
generated: disable
|
||||
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
mode755 = 0755
|
||||
mode644 = 0644
|
||||
mode755 = 0o755
|
||||
mode644 = 0o644
|
||||
)
|
||||
|
||||
const launchConfig = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
@@ -6,9 +6,7 @@ import (
|
||||
"github.com/containers/podman/v6/pkg/domain/entities"
|
||||
)
|
||||
|
||||
var (
|
||||
engineMode = entities.TunnelMode
|
||||
)
|
||||
var engineMode = entities.TunnelMode
|
||||
|
||||
func storeBefore() error {
|
||||
return nil
|
||||
|
||||
@@ -43,9 +43,7 @@ func setupLogging(name string) (*eventlog.Log, error) {
|
||||
|
||||
func installWslKernel() error {
|
||||
logrus.Info("Installing WSL Kernel update")
|
||||
var (
|
||||
err error
|
||||
)
|
||||
var err error
|
||||
backoff := 500 * time.Millisecond
|
||||
for i := 1; i < 6; i++ {
|
||||
err = wutil.SilentExec("--update")
|
||||
|
||||
@@ -12,19 +12,17 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
addCmd = &cobra.Command{
|
||||
Use: "add [options] ARTIFACT PATH [...PATH]",
|
||||
Short: "Add an OCI artifact to the local store",
|
||||
Long: "Add an OCI artifact to the local store from the local filesystem",
|
||||
RunE: add,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteArtifactAdd,
|
||||
Example: `podman artifact add quay.io/myimage/myartifact:latest /tmp/foobar.txt
|
||||
var addCmd = &cobra.Command{
|
||||
Use: "add [options] ARTIFACT PATH [...PATH]",
|
||||
Short: "Add an OCI artifact to the local store",
|
||||
Long: "Add an OCI artifact to the local store from the local filesystem",
|
||||
RunE: add,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteArtifactAdd,
|
||||
Example: `podman artifact add quay.io/myimage/myartifact:latest /tmp/foobar.txt
|
||||
podman artifact add --file-type text/yaml quay.io/myimage/myartifact:latest /tmp/foobar.yaml
|
||||
podman artifact add --append quay.io/myimage/myartifact:latest /tmp/foobar.tar.gz`,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// AddOptionsWrapper wraps entities.ArtifactsAddOptions and prevents leaking
|
||||
// CLI-only fields into the API types.
|
||||
|
||||
@@ -8,22 +8,18 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
extractCmd = &cobra.Command{
|
||||
Use: "extract [options] ARTIFACT PATH",
|
||||
Short: "Extract an OCI artifact to a local path",
|
||||
Long: "Extract the blobs of an OCI artifact to a local file or directory",
|
||||
RunE: extract,
|
||||
Args: cobra.ExactArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteArtifactAdd,
|
||||
Example: `podman artifact Extract quay.io/myimage/myartifact:latest /tmp/foobar.txt
|
||||
var extractCmd = &cobra.Command{
|
||||
Use: "extract [options] ARTIFACT PATH",
|
||||
Short: "Extract an OCI artifact to a local path",
|
||||
Long: "Extract the blobs of an OCI artifact to a local file or directory",
|
||||
RunE: extract,
|
||||
Args: cobra.ExactArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteArtifactAdd,
|
||||
Example: `podman artifact Extract quay.io/myimage/myartifact:latest /tmp/foobar.txt
|
||||
podman artifact Extract quay.io/myimage/myartifact:latest /home/paul/mydir`,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
var (
|
||||
extractOpts entities.ArtifactExtractOptions
|
||||
)
|
||||
var extractOpts entities.ArtifactExtractOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -63,9 +63,7 @@ func (a artifactListOutput) CreatedAt() string {
|
||||
return a.created.String()
|
||||
}
|
||||
|
||||
var (
|
||||
defaultArtifactListOutputFormat = "{{range .}}{{.Repository}}\t{{.Tag}}\t{{.Digest}}\t{{.Created}}\t{{.Size}}\n{{end -}}"
|
||||
)
|
||||
var defaultArtifactListOutputFormat = "{{range .}}{{.Repository}}\t{{.Tag}}\t{{.Digest}}\t{{.Created}}\t{{.Size}}\n{{end -}}"
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -93,9 +91,7 @@ func outputTemplate(cmd *cobra.Command, lrs []*entities.ArtifactListReport) erro
|
||||
var err error
|
||||
artifacts := make([]artifactListOutput, 0)
|
||||
for _, lr := range lrs {
|
||||
var (
|
||||
tag string
|
||||
)
|
||||
var tag string
|
||||
artifactName, err := lr.Artifact.GetName()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -35,6 +35,7 @@ func rmFlags(cmd *cobra.Command) {
|
||||
flags.BoolVarP(&rmOptions.All, "all", "a", false, "Remove all artifacts")
|
||||
flags.BoolVarP(&rmOptions.Ignore, "ignore", "i", false, "Ignore error if artifact does not exist")
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: rmCmd,
|
||||
|
||||
@@ -52,9 +52,11 @@ type BuildFlagsWrapper struct {
|
||||
|
||||
// FarmBuildHiddenFlags are the flags hidden from the farm build command because they are either not
|
||||
// supported or don't make sense in the farm build use case
|
||||
var FarmBuildHiddenFlags = []string{"arch", "all-platforms", "compress", "cw", "disable-content-trust",
|
||||
var FarmBuildHiddenFlags = []string{
|
||||
"arch", "all-platforms", "compress", "cw", "disable-content-trust",
|
||||
"logsplit", "manifest", "os", "output", "platform", "sign-by", "signature-policy", "stdin",
|
||||
"variant"}
|
||||
"variant",
|
||||
}
|
||||
|
||||
func DefineBuildFlags(cmd *cobra.Command, buildOpts *BuildFlagsWrapper, isFarmBuild bool) {
|
||||
flags := cmd.Flags()
|
||||
|
||||
@@ -1186,8 +1186,10 @@ func AutocompletePullOption(_ *cobra.Command, _ []string, _ string) ([]string, c
|
||||
// AutocompleteRestartOption - Autocomplete restart options for create and run command.
|
||||
// -> "always", "no", "on-failure", "unless-stopped"
|
||||
func AutocompleteRestartOption(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
restartOptions := []string{define.RestartPolicyAlways, define.RestartPolicyNo,
|
||||
define.RestartPolicyOnFailure, define.RestartPolicyUnlessStopped}
|
||||
restartOptions := []string{
|
||||
define.RestartPolicyAlways, define.RestartPolicyNo,
|
||||
define.RestartPolicyOnFailure, define.RestartPolicyUnlessStopped,
|
||||
}
|
||||
return restartOptions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
@@ -1595,7 +1597,8 @@ func getMethodNames(f reflect.Value, prefix string) []formatSuggestion {
|
||||
// -> "container=", "event=", "image=", "pod=", "volume=", "type="
|
||||
func AutocompleteEventFilter(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
event := func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{events.Attach.String(), events.AutoUpdate.String(), events.Checkpoint.String(), events.Cleanup.String(),
|
||||
return []string{
|
||||
events.Attach.String(), events.AutoUpdate.String(), events.Checkpoint.String(), events.Cleanup.String(),
|
||||
events.Commit.String(), events.Create.String(), events.Exec.String(), events.ExecDied.String(),
|
||||
events.Exited.String(), events.Export.String(), events.Import.String(), events.Init.String(), events.Kill.String(),
|
||||
events.LoadFromArchive.String(), events.Mount.String(), events.NetworkConnect.String(),
|
||||
@@ -1607,7 +1610,8 @@ func AutocompleteEventFilter(cmd *cobra.Command, _ []string, toComplete string)
|
||||
}, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
eventTypes := func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{events.Container.String(), events.Image.String(), events.Network.String(),
|
||||
return []string{
|
||||
events.Container.String(), events.Image.String(), events.Network.String(),
|
||||
events.Pod.String(), events.System.String(), events.Volume.String(), events.Secret.String(),
|
||||
}, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
@@ -1710,9 +1714,11 @@ func AutocompleteImageSaveFormat(_ *cobra.Command, _ []string, _ string) ([]stri
|
||||
// AutocompleteWaitCondition - Autocomplete wait condition options.
|
||||
// -> "unknown", "configured", "created", "running", "stopped", "paused", "exited", "removing"
|
||||
func AutocompleteWaitCondition(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
states := []string{"unknown", "configured", "created", "exited",
|
||||
states := []string{
|
||||
"unknown", "configured", "created", "exited",
|
||||
"healthy", "initialized", "paused", "removing", "running",
|
||||
"stopped", "stopping", "unhealthy"}
|
||||
"stopped", "stopping", "unhealthy",
|
||||
}
|
||||
return states, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
@@ -1792,8 +1798,10 @@ func AutocompletePsFilters(cmd *cobra.Command, _ []string, toComplete string) ([
|
||||
"command=": func(s string) ([]string, cobra.ShellCompDirective) { return getCommands(cmd, s) },
|
||||
"exited=": nil,
|
||||
"health=": func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{define.HealthCheckHealthy,
|
||||
define.HealthCheckUnhealthy}, cobra.ShellCompDirectiveNoFileComp
|
||||
return []string{
|
||||
define.HealthCheckHealthy,
|
||||
define.HealthCheckUnhealthy,
|
||||
}, cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
"id=": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeIDs) },
|
||||
"label=": nil,
|
||||
@@ -1832,8 +1840,10 @@ func AutocompletePodPsFilters(cmd *cobra.Command, _ []string, toComplete string)
|
||||
"name=": func(s string) ([]string, cobra.ShellCompDirective) { return getPods(cmd, s, completeNames) },
|
||||
"network=": func(s string) ([]string, cobra.ShellCompDirective) { return getNetworks(cmd, s, completeDefault) },
|
||||
"status=": func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{"stopped", "running",
|
||||
"paused", "exited", "dead", "created", "degraded"}, cobra.ShellCompDirectiveNoFileComp
|
||||
return []string{
|
||||
"stopped", "running",
|
||||
"paused", "exited", "dead", "created", "degraded",
|
||||
}, cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
"until=": nil,
|
||||
}
|
||||
@@ -2002,7 +2012,6 @@ func AutocompleteSysctl(_ *cobra.Command, _ []string, toComplete string) ([]stri
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, cobra.ShellCompDirectiveError
|
||||
}
|
||||
|
||||
@@ -180,9 +180,11 @@ func TestAutocompleteFormat(t *testing.T) {
|
||||
{
|
||||
"two variables struct field name",
|
||||
"{{ .Car.Brand }} {{ .Car.",
|
||||
[]string{"{{ .Car.Brand }} {{ .Car.Color}}", "{{ .Car.Brand }} {{ .Car.Struct.", "{{ .Car.Brand }} {{ .Car.Type}}",
|
||||
[]string{
|
||||
"{{ .Car.Brand }} {{ .Car.Color}}", "{{ .Car.Brand }} {{ .Car.Struct.", "{{ .Car.Brand }} {{ .Car.Type}}",
|
||||
"{{ .Car.Brand }} {{ .Car.Brand}}", "{{ .Car.Brand }} {{ .Car.Stats.", "{{ .Car.Brand }} {{ .Car.Extras.",
|
||||
"{{ .Car.Brand }} {{ .Car.Extras2."},
|
||||
"{{ .Car.Brand }} {{ .Car.Extras2.",
|
||||
},
|
||||
},
|
||||
{
|
||||
"only dot without variable",
|
||||
|
||||
@@ -430,7 +430,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
|
||||
timezoneFlagName, cf.Timezone,
|
||||
"Set timezone in container",
|
||||
)
|
||||
_ = cmd.RegisterFlagCompletionFunc(timezoneFlagName, completion.AutocompleteNone) //TODO: add timezone completion
|
||||
_ = cmd.RegisterFlagCompletionFunc(timezoneFlagName, completion.AutocompleteNone) // TODO: add timezone completion
|
||||
|
||||
umaskFlagName := "umask"
|
||||
createFlags.StringVar(
|
||||
|
||||
@@ -4,7 +4,5 @@ import (
|
||||
"github.com/containers/podman/v6/cmd/podman/registry"
|
||||
)
|
||||
|
||||
var (
|
||||
// Pull in configured json library
|
||||
json = registry.JSONLibrary()
|
||||
)
|
||||
// Pull in configured json library
|
||||
var json = registry.JSONLibrary()
|
||||
|
||||
@@ -107,9 +107,7 @@ func DefineNetFlags(cmd *cobra.Command) {
|
||||
|
||||
// NetFlagsToNetOptions parses the network flags for the given cmd.
|
||||
func NetFlagsToNetOptions(opts *entities.NetOptions, flags pflag.FlagSet) (*entities.NetOptions, error) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
var err error
|
||||
if opts == nil {
|
||||
opts = &entities.NetOptions{}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
attachOpts entities.AttachOptions
|
||||
)
|
||||
var attachOpts entities.AttachOptions
|
||||
|
||||
func attachFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
|
||||
@@ -35,9 +35,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
cleanupOptions entities.ContainerCleanupOptions
|
||||
)
|
||||
var cleanupOptions entities.ContainerCleanupOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -62,9 +60,7 @@ func init() {
|
||||
}
|
||||
|
||||
func cleanup(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
|
||||
if cleanupOptions.Exec != "" {
|
||||
switch {
|
||||
|
||||
@@ -24,9 +24,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
ctrClone entities.ContainerCloneOptions
|
||||
)
|
||||
var ctrClone entities.ContainerCloneOptions
|
||||
|
||||
func cloneFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
@@ -43,6 +41,7 @@ func cloneFlags(cmd *cobra.Command) {
|
||||
common.DefineCreateDefaults(&ctrClone.CreateOpts)
|
||||
common.DefineCreateFlags(cmd, &ctrClone.CreateOpts, entities.CloneMode)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: containerCloneCommand,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package containers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -10,8 +11,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"errors"
|
||||
|
||||
buildahCopiah "github.com/containers/buildah/copier"
|
||||
"github.com/containers/podman/v6/cmd/podman/common"
|
||||
"github.com/containers/podman/v6/cmd/podman/registry"
|
||||
@@ -466,16 +465,16 @@ func resolvePathOnDestinationContainer(container string, containerPath string, i
|
||||
containerInfo, err = registry.ContainerEngine().ContainerStat(registry.Context(), container, containerPath)
|
||||
if err == nil {
|
||||
baseName = path.Base(containerInfo.LinkTarget)
|
||||
return //nolint: nilerr
|
||||
return baseName, containerInfo, resolvedToParentDir, err //nolint: nilerr
|
||||
}
|
||||
|
||||
if strings.HasSuffix(containerPath, "/") {
|
||||
err = fmt.Errorf("%q could not be found on container %s: %w", containerPath, container, err)
|
||||
return
|
||||
return baseName, containerInfo, resolvedToParentDir, err
|
||||
}
|
||||
if isStdin {
|
||||
err = errors.New("destination must be a directory when copying from stdin")
|
||||
return
|
||||
return baseName, containerInfo, resolvedToParentDir, err
|
||||
}
|
||||
|
||||
// NOTE: containerInfo may actually be set. That happens when
|
||||
@@ -492,13 +491,13 @@ func resolvePathOnDestinationContainer(container string, containerPath string, i
|
||||
parentDir, err := containerParentDir(container, parentPath)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not determine parent dir of %q on container %s: %w", parentPath, container, err)
|
||||
return
|
||||
return baseName, containerInfo, resolvedToParentDir, err
|
||||
}
|
||||
|
||||
containerInfo, err = registry.ContainerEngine().ContainerStat(registry.Context(), container, parentDir)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("%q could not be found on container %s: %w", containerPath, container, err)
|
||||
return
|
||||
return baseName, containerInfo, resolvedToParentDir, err
|
||||
}
|
||||
|
||||
resolvedToParentDir = true
|
||||
|
||||
@@ -40,9 +40,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
initOptions entities.ContainerInitOptions
|
||||
)
|
||||
var initOptions entities.ContainerInitOptions
|
||||
|
||||
func initFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&initOptions.All, "all", "a", false, "Initialize all containers")
|
||||
|
||||
@@ -7,21 +7,19 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
// podman container _list_
|
||||
listCmd = &cobra.Command{
|
||||
Use: "list [options]",
|
||||
Aliases: []string{"ls"},
|
||||
Args: validate.NoArgs,
|
||||
Short: "List containers",
|
||||
Long: "Prints out information about the containers",
|
||||
RunE: ps,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman container list -a
|
||||
// podman container _list_
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list [options]",
|
||||
Aliases: []string{"ls"},
|
||||
Args: validate.NoArgs,
|
||||
Short: "List containers",
|
||||
Long: "Prints out information about the containers",
|
||||
RunE: ps,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman container list -a
|
||||
podman container list -a --format "{{.ID}} {{.Image}} {{.Labels}} {{.Mounts}}"
|
||||
podman container list --size --sort names`,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -49,9 +49,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
mountOpts entities.ContainerMountOptions
|
||||
)
|
||||
var mountOpts entities.ContainerMountOptions
|
||||
|
||||
func mountFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
|
||||
@@ -87,9 +87,7 @@ func init() {
|
||||
}
|
||||
|
||||
func pause(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
args = utils.RemoveSlash(args)
|
||||
|
||||
for _, cidFile := range pauseCidFiles {
|
||||
|
||||
@@ -44,9 +44,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
portOpts entities.ContainerPortOptions
|
||||
)
|
||||
var portOpts entities.ContainerPortOptions
|
||||
|
||||
func portFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&portOpts.All, "all", "a", false, "Display port information for all containers")
|
||||
|
||||
@@ -69,7 +69,6 @@ func prune(_ *cobra.Command, _ []string) error {
|
||||
return err
|
||||
}
|
||||
responses, err := registry.ContainerEngine().ContainerPrune(context.Background(), pruneOptions)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ var (
|
||||
Example: strings.ReplaceAll(psCommand.Example, "podman ps", "podman container ps"),
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
listOpts = entities.ContainerListOptions{
|
||||
Filters: make(map[string][]string),
|
||||
@@ -107,6 +108,7 @@ func listFlagSet(cmd *cobra.Command) {
|
||||
|
||||
flags.SetNormalizeFunc(utils.AliasFlags)
|
||||
}
|
||||
|
||||
func checkFlags(c *cobra.Command) error {
|
||||
// latest, and last are mutually exclusive.
|
||||
if listOpts.Last >= 0 && listOpts.Latest {
|
||||
|
||||
@@ -94,9 +94,7 @@ func init() {
|
||||
}
|
||||
|
||||
func restart(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
args = utils.RemoveSlash(args)
|
||||
|
||||
if cmd.Flag("time").Changed {
|
||||
|
||||
@@ -40,11 +40,9 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
startOptions = entities.ContainerStartOptions{
|
||||
Filters: make(map[string][]string),
|
||||
}
|
||||
)
|
||||
var startOptions = entities.ContainerStartOptions{
|
||||
Filters: make(map[string][]string),
|
||||
}
|
||||
|
||||
func startFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
@@ -68,6 +66,7 @@ func startFlags(cmd *cobra.Command) {
|
||||
_ = flags.MarkHidden("sig-proxy")
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: startCommand,
|
||||
|
||||
@@ -97,9 +97,7 @@ func init() {
|
||||
}
|
||||
|
||||
func stop(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
args = utils.RemoveSlash(args)
|
||||
|
||||
if cmd.Flag("time").Changed {
|
||||
|
||||
@@ -52,9 +52,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
unmountOpts entities.ContainerUnmountOptions
|
||||
)
|
||||
var unmountOpts entities.ContainerUnmountOptions
|
||||
|
||||
func unmountFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&unmountOpts.All, "all", "a", false, "Unmount all of the currently mounted containers")
|
||||
|
||||
@@ -88,9 +88,7 @@ func init() {
|
||||
}
|
||||
|
||||
func unpause(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
args = utils.RemoveSlash(args)
|
||||
|
||||
if rootless.IsRootless() && !registry.IsRemote() {
|
||||
|
||||
@@ -6,15 +6,13 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// Command: podman _farm_
|
||||
farmCmd = &cobra.Command{
|
||||
Use: "farm",
|
||||
Short: "Farm out builds to remote machines",
|
||||
Long: "Farm out builds to remote machines that podman can connect to via podman system connection",
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
)
|
||||
// Command: podman _farm_
|
||||
var farmCmd = &cobra.Command{
|
||||
Use: "farm",
|
||||
Short: "Farm out builds to remote machines",
|
||||
Long: "Farm out builds to remote machines that podman can connect to via podman system connection",
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -12,21 +12,17 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
specCmd = &cobra.Command{
|
||||
Use: "spec [options] {CONTAINER|POD}",
|
||||
Short: "Generate Specgen JSON based on containers or pods",
|
||||
Long: "Generate Specgen JSON based on containers or pods",
|
||||
RunE: spec,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainersAndPods,
|
||||
Example: `podman generate spec ctrID`,
|
||||
}
|
||||
)
|
||||
var specCmd = &cobra.Command{
|
||||
Use: "spec [options] {CONTAINER|POD}",
|
||||
Short: "Generate Specgen JSON based on containers or pods",
|
||||
Long: "Generate Specgen JSON based on containers or pods",
|
||||
RunE: spec,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainersAndPods,
|
||||
Example: `podman generate spec ctrID`,
|
||||
}
|
||||
|
||||
var (
|
||||
opts *entities.GenerateSpecOptions
|
||||
)
|
||||
var opts *entities.GenerateSpecOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -6,14 +6,12 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
healthCmd = &cobra.Command{
|
||||
Use: "healthcheck",
|
||||
Short: "Manage health checks on containers",
|
||||
Long: "Run health checks on containers",
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
)
|
||||
var healthCmd = &cobra.Command{
|
||||
Use: "healthcheck",
|
||||
Short: "Manage health checks on containers",
|
||||
Long: "Run health checks on containers",
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -11,17 +11,15 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
runCmd = &cobra.Command{
|
||||
Use: "run CONTAINER",
|
||||
Short: "Run the health check of a container",
|
||||
Long: "Run the health check of a container",
|
||||
Example: `podman healthcheck run mywebapp`,
|
||||
RunE: run,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainersRunning,
|
||||
}
|
||||
)
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "run CONTAINER",
|
||||
Short: "Run the health check of a container",
|
||||
Long: "Run the health check of a container",
|
||||
Example: `podman healthcheck run mywebapp`,
|
||||
RunE: run,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainersRunning,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -97,7 +97,6 @@ func build(cmd *cobra.Command, args []string) error {
|
||||
}()
|
||||
}
|
||||
report, err := registry.ImageEngine().Build(registry.Context(), apiBuildOpts.ContainerFiles, *apiBuildOpts)
|
||||
|
||||
if err != nil {
|
||||
exitCode := buildahCLI.ExecErrorCodeGeneric
|
||||
if registry.IsRemote() {
|
||||
|
||||
@@ -6,22 +6,20 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// Command: podman _buildx_
|
||||
// This is a hidden command, which was added to make converting
|
||||
// from Docker to Podman easier.
|
||||
// For now podman buildx build just calls into podman build
|
||||
// If we are adding new buildx features, we will add them by default
|
||||
// to podman build.
|
||||
buildxCmd = &cobra.Command{
|
||||
Use: "buildx",
|
||||
Aliases: []string{"builder"},
|
||||
Short: "Build images",
|
||||
Long: "Build images",
|
||||
RunE: validate.SubCommandExists,
|
||||
Hidden: true,
|
||||
}
|
||||
)
|
||||
// Command: podman _buildx_
|
||||
// This is a hidden command, which was added to make converting
|
||||
// from Docker to Podman easier.
|
||||
// For now podman buildx build just calls into podman build
|
||||
// If we are adding new buildx features, we will add them by default
|
||||
// to podman build.
|
||||
var buildxCmd = &cobra.Command{
|
||||
Use: "buildx",
|
||||
Aliases: []string{"builder"},
|
||||
Short: "Build images",
|
||||
Long: "Build images",
|
||||
RunE: validate.SubCommandExists,
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -41,7 +41,6 @@ func init() {
|
||||
|
||||
func runBuildxInspect(_ *cobra.Command, _ []string) error {
|
||||
info, err := registry.ContainerEngine().Info(registry.Context())
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("retrieving podman information: %w", err)
|
||||
}
|
||||
|
||||
@@ -6,18 +6,16 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
existsCmd = &cobra.Command{
|
||||
Use: "exists IMAGE",
|
||||
Short: "Check if an image exists in local storage",
|
||||
Long: `If the named image exists in local storage, podman image exists exits with 0, otherwise the exit code will be 1.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: exists,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman image exists ID
|
||||
var existsCmd = &cobra.Command{
|
||||
Use: "exists IMAGE",
|
||||
Short: "Check if an image exists in local storage",
|
||||
Long: `If the named image exists in local storage, podman image exists exits with 0, otherwise the exit code will be 1.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: exists,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman image exists ID
|
||||
podman image exists IMAGE && podman pull IMAGE`,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -47,9 +47,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
importOpts entities.ImageImportOptions
|
||||
)
|
||||
var importOpts entities.ImageImportOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -40,9 +40,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
loadOpts entities.ImageLoadOptions
|
||||
)
|
||||
var loadOpts entities.ImageLoadOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -38,9 +38,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
mountOpts entities.ImageMountOptions
|
||||
)
|
||||
var mountOpts entities.ImageMountOptions
|
||||
|
||||
func mountFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
|
||||
@@ -18,9 +18,7 @@ import (
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
var (
|
||||
containerConfig = registry.PodmanConfig()
|
||||
)
|
||||
var containerConfig = registry.PodmanConfig()
|
||||
|
||||
var (
|
||||
saveDescription = `Save an image to docker-archive or oci-archive on the local machine. Default is docker-archive.`
|
||||
@@ -62,9 +60,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
saveOpts entities.ImageSaveOptions
|
||||
)
|
||||
var saveOpts entities.ImageSaveOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -46,9 +46,7 @@ func scpFlags(cmd *cobra.Command) {
|
||||
}
|
||||
|
||||
func scp(_ *cobra.Command, args []string) (finalErr error) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
var err error
|
||||
|
||||
containerConfig := registry.PodmanConfig()
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
signOptions entities.SignOptions
|
||||
)
|
||||
var signOptions entities.SignOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -27,9 +27,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
setOptions entities.SetTrustOptions
|
||||
)
|
||||
var setOptions entities.SetTrustOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -26,9 +26,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
showTrustOptions entities.ShowTrustOptions
|
||||
)
|
||||
var showTrustOptions entities.ShowTrustOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -33,9 +33,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
unmountOpts entities.ImageUnmountOptions
|
||||
)
|
||||
var unmountOpts entities.ImageUnmountOptions
|
||||
|
||||
func unmountFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&unmountOpts.All, "all", "a", false, "Unmount all of the currently mounted images")
|
||||
|
||||
@@ -78,7 +78,7 @@ func login(cmd *cobra.Command, args []string) error {
|
||||
if len(loginOptions.Username) == 0 {
|
||||
loginOptions.Username = secretName
|
||||
}
|
||||
var inspectOpts = entities.SecretInspectOptions{
|
||||
inspectOpts := entities.SecretInspectOptions{
|
||||
ShowSecret: true,
|
||||
}
|
||||
inspected, errs, _ := registry.ContainerEngine().SecretInspect(context.Background(), []string{secretName}, inspectOpts)
|
||||
|
||||
@@ -17,18 +17,16 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
client9pCommand = &cobra.Command{
|
||||
Args: cobra.ExactArgs(2),
|
||||
Use: "client9p PORT DIR",
|
||||
Hidden: true,
|
||||
Short: "Mount a remote directory using 9p over hvsock",
|
||||
Long: "Connect to the given hvsock port using 9p and mount the served filesystem at the given directory",
|
||||
RunE: remoteDirClient,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman system client9p 55000 /mnt`,
|
||||
}
|
||||
)
|
||||
var client9pCommand = &cobra.Command{
|
||||
Args: cobra.ExactArgs(2),
|
||||
Use: "client9p PORT DIR",
|
||||
Hidden: true,
|
||||
Short: "Mount a remote directory using 9p over hvsock",
|
||||
Long: "Connect to the given hvsock port using 9p and mount the served filesystem at the given directory",
|
||||
RunE: remoteDirClient,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman system client9p 55000 /mnt`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -23,22 +23,18 @@ import (
|
||||
|
||||
var infoDescription = `Display information pertaining to the machine host.`
|
||||
|
||||
var (
|
||||
infoCmd = &cobra.Command{
|
||||
Use: "info [options]",
|
||||
Short: "Display machine host info",
|
||||
Long: infoDescription,
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: info,
|
||||
Args: validate.NoArgs,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman machine info`,
|
||||
}
|
||||
)
|
||||
var infoCmd = &cobra.Command{
|
||||
Use: "info [options]",
|
||||
Short: "Display machine host info",
|
||||
Long: infoDescription,
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: info,
|
||||
Args: validate.NoArgs,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman machine info`,
|
||||
}
|
||||
|
||||
var (
|
||||
inFormat string
|
||||
)
|
||||
var inFormat string
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -45,9 +45,7 @@ func init() {
|
||||
}
|
||||
|
||||
func inspect(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
if len(args) < 1 {
|
||||
args = append(args, defaultMachineName)
|
||||
}
|
||||
|
||||
@@ -8,15 +8,13 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
OSCmd = &cobra.Command{
|
||||
Use: "os",
|
||||
Short: "Manage a Podman virtual machine's OS",
|
||||
Long: "Manage a Podman virtual machine's operating system",
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
)
|
||||
var OSCmd = &cobra.Command{
|
||||
Use: "os",
|
||||
Short: "Manage a Podman virtual machine's OS",
|
||||
Long: "Manage a Podman virtual machine's operating system",
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -11,18 +11,16 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
applyCmd = &cobra.Command{
|
||||
Use: "apply [options] IMAGE [NAME]",
|
||||
Short: "Apply an OCI image to a Podman Machine's OS",
|
||||
Long: "Apply custom layers from a containerized Fedora CoreOS OCI image on top of an existing VM",
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
Args: cobra.RangeArgs(1, 2),
|
||||
RunE: apply,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman machine os apply myimage`,
|
||||
}
|
||||
)
|
||||
var applyCmd = &cobra.Command{
|
||||
Use: "apply [options] IMAGE [NAME]",
|
||||
Short: "Apply an OCI image to a Podman Machine's OS",
|
||||
Long: "Apply custom layers from a containerized Fedora CoreOS OCI image on top of an existing VM",
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
Args: cobra.RangeArgs(1, 2),
|
||||
RunE: apply,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman machine os apply myimage`,
|
||||
}
|
||||
|
||||
var restart bool
|
||||
|
||||
|
||||
@@ -19,21 +19,17 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
resetCmd = &cobra.Command{
|
||||
Use: "reset [options]",
|
||||
Short: "Remove all machines",
|
||||
Long: "Remove all machines, configurations, data, and cached images",
|
||||
RunE: reset,
|
||||
Args: validate.NoArgs,
|
||||
Example: `podman machine reset`,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
}
|
||||
)
|
||||
var resetCmd = &cobra.Command{
|
||||
Use: "reset [options]",
|
||||
Short: "Remove all machines",
|
||||
Long: "Remove all machines, configurations, data, and cached images",
|
||||
RunE: reset,
|
||||
Args: validate.NoArgs,
|
||||
Example: `podman machine reset`,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
}
|
||||
|
||||
var (
|
||||
resetOptions machine.ResetOptions
|
||||
)
|
||||
var resetOptions machine.ResetOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -10,22 +10,18 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
rmCmd = &cobra.Command{
|
||||
Use: "rm [options] [MACHINE]",
|
||||
Short: "Remove an existing machine",
|
||||
Long: "Remove a managed virtual machine ",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: rm,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: `podman machine rm podman-machine-default`,
|
||||
ValidArgsFunction: autocompleteMachine,
|
||||
}
|
||||
)
|
||||
var rmCmd = &cobra.Command{
|
||||
Use: "rm [options] [MACHINE]",
|
||||
Short: "Remove an existing machine",
|
||||
Long: "Remove a managed virtual machine ",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: rm,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: `podman machine rm podman-machine-default`,
|
||||
ValidArgsFunction: autocompleteMachine,
|
||||
}
|
||||
|
||||
var (
|
||||
destroyOptions machine.RemoveOptions
|
||||
)
|
||||
var destroyOptions machine.RemoveOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -45,9 +41,7 @@ func init() {
|
||||
}
|
||||
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
var err error
|
||||
vmName := defaultMachineName
|
||||
if len(args) > 0 && len(args[0]) > 0 {
|
||||
vmName = args[0]
|
||||
|
||||
@@ -16,18 +16,16 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
server9pCommand = &cobra.Command{
|
||||
Args: cobra.ExactArgs(1),
|
||||
Use: "server9p [options] PID",
|
||||
Hidden: true,
|
||||
Short: "Serve a directory using 9p over hvsock",
|
||||
Long: "Start a number of 9p servers on given hvsock UUIDs, and run until the given PID exits",
|
||||
RunE: remoteDirServer,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman system server9p --serve C:\Users\myuser:00000050-FACB-11E6-BD58-64006A7986D3 /mnt`,
|
||||
}
|
||||
)
|
||||
var server9pCommand = &cobra.Command{
|
||||
Args: cobra.ExactArgs(1),
|
||||
Use: "server9p [options] PID",
|
||||
Hidden: true,
|
||||
Short: "Serve a directory using 9p over hvsock",
|
||||
Long: "Start a number of 9p servers on given hvsock UUIDs, and run until the given PID exits",
|
||||
RunE: remoteDirServer,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman system server9p --serve C:\Users\myuser:00000050-FACB-11E6-BD58-64006A7986D3 /mnt`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -42,9 +40,7 @@ func init() {
|
||||
_ = server9pCommand.RegisterFlagCompletionFunc(serveFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
var (
|
||||
serveDirs []string
|
||||
)
|
||||
var serveDirs []string
|
||||
|
||||
func remoteDirServer(_ *cobra.Command, args []string) error {
|
||||
pid, err := strconv.Atoi(args[0])
|
||||
|
||||
@@ -11,18 +11,16 @@ import (
|
||||
"go.podman.io/common/pkg/strongunits"
|
||||
)
|
||||
|
||||
var (
|
||||
setCmd = &cobra.Command{
|
||||
Use: "set [options] [NAME]",
|
||||
Short: "Set a virtual machine setting",
|
||||
Long: "Set an updatable virtual machine setting",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: setMachine,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: `podman machine set --rootful=false`,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
}
|
||||
)
|
||||
var setCmd = &cobra.Command{
|
||||
Use: "set [options] [NAME]",
|
||||
Short: "Set a virtual machine setting",
|
||||
Long: "Set an updatable virtual machine setting",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: setMachine,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: `podman machine set --rootful=false`,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
}
|
||||
|
||||
var (
|
||||
setFlags = SetFlags{}
|
||||
|
||||
@@ -16,22 +16,18 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
sshCmd = &cobra.Command{
|
||||
Use: "ssh [options] [NAME] [COMMAND [ARG ...]]",
|
||||
Short: "SSH into an existing machine",
|
||||
Long: "SSH into a managed virtual machine ",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: ssh,
|
||||
Example: `podman machine ssh podman-machine-default
|
||||
var sshCmd = &cobra.Command{
|
||||
Use: "ssh [options] [NAME] [COMMAND [ARG ...]]",
|
||||
Short: "SSH into an existing machine",
|
||||
Long: "SSH into a managed virtual machine ",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: ssh,
|
||||
Example: `podman machine ssh podman-machine-default
|
||||
podman machine ssh myvm echo hello`,
|
||||
ValidArgsFunction: autocompleteMachineSSH,
|
||||
}
|
||||
)
|
||||
ValidArgsFunction: autocompleteMachineSSH,
|
||||
}
|
||||
|
||||
var (
|
||||
sshOpts machine.SSHOptions
|
||||
)
|
||||
var sshOpts machine.SSHOptions
|
||||
|
||||
func init() {
|
||||
sshCmd.Flags().SetInterspersed(false)
|
||||
|
||||
@@ -11,18 +11,16 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
stopCmd = &cobra.Command{
|
||||
Use: "stop [MACHINE]",
|
||||
Short: "Stop an existing machine",
|
||||
Long: "Stop a managed virtual machine ",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: stop,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: `podman machine stop podman-machine-default`,
|
||||
ValidArgsFunction: autocompleteMachine,
|
||||
}
|
||||
)
|
||||
var stopCmd = &cobra.Command{
|
||||
Use: "stop [MACHINE]",
|
||||
Short: "Stop an existing machine",
|
||||
Long: "Stop a managed virtual machine ",
|
||||
PersistentPreRunE: machinePreRunE,
|
||||
RunE: stop,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: `podman machine stop podman-machine-default`,
|
||||
ValidArgsFunction: autocompleteMachine,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -33,9 +31,7 @@ func init() {
|
||||
|
||||
// TODO Name shouldn't be required, need to create a default vm
|
||||
func stop(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
var err error
|
||||
|
||||
vmName := defaultMachineName
|
||||
if len(args) > 0 && len(args[0]) > 0 {
|
||||
|
||||
@@ -41,6 +41,7 @@ type logrusLogger struct{}
|
||||
func (l logrusLogger) Errorf(format string, args ...any) {
|
||||
logrus.Errorf(format, args...)
|
||||
}
|
||||
|
||||
func (l logrusLogger) Debugf(format string, args ...any) {
|
||||
logrus.Debugf(format, args...)
|
||||
}
|
||||
|
||||
@@ -6,17 +6,15 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
existsCmd = &cobra.Command{
|
||||
Use: "exists MANIFEST",
|
||||
Short: "Check if a manifest list exists in local storage",
|
||||
Long: `If the manifest list exists in local storage, podman manifest exists exits with 0, otherwise the exit code will be 1.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: exists,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: "podman manifest exists mylist",
|
||||
}
|
||||
)
|
||||
var existsCmd = &cobra.Command{
|
||||
Use: "exists MANIFEST",
|
||||
Short: "Check if a manifest list exists in local storage",
|
||||
Long: `If the manifest list exists in local storage, podman manifest exists exits with 0, otherwise the exit code will be 1.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: exists,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: "podman manifest exists mylist",
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -8,17 +8,15 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
removeCmd = &cobra.Command{
|
||||
Use: "remove LIST DIGEST",
|
||||
Short: "Remove an item from a manifest list or image index",
|
||||
Long: "Removes an item from a manifest list or image index.",
|
||||
RunE: remove,
|
||||
Args: cobra.ExactArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteManifestListAndMember,
|
||||
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
|
||||
}
|
||||
)
|
||||
var removeCmd = &cobra.Command{
|
||||
Use: "remove LIST DIGEST",
|
||||
Short: "Remove an item from a manifest list or image index",
|
||||
Long: "Removes an item from a manifest list or image index.",
|
||||
RunE: remove,
|
||||
Args: cobra.ExactArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteManifestListAndMember,
|
||||
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -94,6 +94,7 @@ func networkCreateFlags(cmd *cobra.Command) {
|
||||
flags.StringSliceVar(&networkCreateOptions.NetworkDNSServers, dnsserverFlagName, nil, "DNS servers this network will use")
|
||||
_ = cmd.RegisterFlagCompletionFunc(dnsserverFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: networkCreateCommand,
|
||||
@@ -103,9 +104,7 @@ func init() {
|
||||
}
|
||||
|
||||
func networkCreate(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
name string
|
||||
)
|
||||
var name string
|
||||
if len(args) > 0 {
|
||||
name = args[0]
|
||||
}
|
||||
@@ -184,7 +183,6 @@ func networkCreate(cmd *cobra.Command, args []string) error {
|
||||
|
||||
for i := range networkCreateOptions.Routes {
|
||||
route, err := parseRoute(networkCreateOptions.Routes[i])
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -225,7 +223,6 @@ func parseRoute(routeStr string) (*types.Route, error) {
|
||||
|
||||
if len(s) == 3 {
|
||||
mtr, err := strconv.ParseUint(s[2], 10, 32)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid route metric %s", s[2])
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
networkDisconnectOptions entities.NetworkDisconnectOptions
|
||||
)
|
||||
var networkDisconnectOptions entities.NetworkDisconnectOptions
|
||||
|
||||
func networkDisconnectFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&networkDisconnectOptions.Force, "force", "f", false, "force removal of container from network")
|
||||
|
||||
@@ -29,9 +29,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
reloadOptions entities.NetworkReloadOptions
|
||||
)
|
||||
var reloadOptions entities.NetworkReloadOptions
|
||||
|
||||
func reloadFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&reloadOptions.All, "all", "a", false, "Reload network configuration of all containers")
|
||||
|
||||
@@ -30,9 +30,7 @@ var (
|
||||
stopTimeout int
|
||||
)
|
||||
|
||||
var (
|
||||
networkRmOptions entities.NetworkRmOptions
|
||||
)
|
||||
var networkRmOptions entities.NetworkRmOptions
|
||||
|
||||
func networkRmFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVarP(&networkRmOptions.Force, "force", "f", false, "remove any containers using network")
|
||||
@@ -51,9 +49,7 @@ func init() {
|
||||
}
|
||||
|
||||
func networkRm(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
|
||||
if cmd.Flag("time").Changed {
|
||||
if !networkRmOptions.Force {
|
||||
|
||||
@@ -23,9 +23,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
networkUpdateOptions entities.NetworkUpdateOptions
|
||||
)
|
||||
var networkUpdateOptions entities.NetworkUpdateOptions
|
||||
|
||||
func networkUpdateFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
@@ -37,6 +35,7 @@ func networkUpdateFlags(cmd *cobra.Command) {
|
||||
_ = cmd.RegisterFlagCompletionFunc(addDNSServerFlagName, completion.AutocompleteNone)
|
||||
_ = cmd.RegisterFlagCompletionFunc(removeDNSServerFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: networkUpdateCommand,
|
||||
|
||||
@@ -57,7 +57,7 @@ func ValidateExtraHost(val string) (string, error) {
|
||||
// validateIPAddress validates an Ip address.
|
||||
// for dns, ip, and ip6 flags also
|
||||
func validateIPAddress(val string) (string, error) {
|
||||
var ip = net.ParseIP(strings.TrimSpace(val))
|
||||
ip := net.ParseIP(strings.TrimSpace(val))
|
||||
if ip != nil {
|
||||
return ip.String(), nil
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ import (
|
||||
"go.podman.io/common/libnetwork/etchosts"
|
||||
)
|
||||
|
||||
var (
|
||||
Var1 = []string{"ONE=1", "TWO=2"}
|
||||
)
|
||||
var Var1 = []string{"ONE=1", "TWO=2"}
|
||||
|
||||
func createTmpFile(content []byte) (string, error) {
|
||||
tmpfile, err := os.CreateTemp(os.TempDir(), "unittest")
|
||||
|
||||
@@ -26,9 +26,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
podClone entities.PodCloneOptions
|
||||
)
|
||||
var podClone entities.PodCloneOptions
|
||||
|
||||
func cloneFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
@@ -54,6 +52,7 @@ func cloneFlags(cmd *cobra.Command) {
|
||||
// TODO: add support for container specific arguments/flags
|
||||
common.DefineCreateDefaults(&podClone.PerContainerOptions)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: podCloneCommand,
|
||||
|
||||
@@ -30,9 +30,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
killOpts entities.PodKillOptions
|
||||
)
|
||||
var killOpts entities.PodKillOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -50,9 +48,7 @@ func init() {
|
||||
}
|
||||
|
||||
func kill(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
responses, err := registry.ContainerEngine().PodKill(context.Background(), args, killOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -30,9 +30,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
pauseOptions entities.PodPauseOptions
|
||||
)
|
||||
var pauseOptions entities.PodPauseOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -43,10 +41,9 @@ func init() {
|
||||
flags.BoolVarP(&pauseOptions.All, "all", "a", false, "Pause all running pods")
|
||||
validate.AddLatestFlag(pauseCommand, &pauseOptions.Latest)
|
||||
}
|
||||
|
||||
func pause(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
responses, err := registry.ContainerEngine().PodPause(context.Background(), args, pauseOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -15,9 +15,7 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
pruneOptions = entities.PodPruneOptions{}
|
||||
)
|
||||
var pruneOptions = entities.PodPruneOptions{}
|
||||
|
||||
var (
|
||||
pruneDescription = `podman pod prune Removes all exited pods`
|
||||
|
||||
@@ -30,9 +30,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
restartOptions = entities.PodRestartOptions{}
|
||||
)
|
||||
var restartOptions = entities.PodRestartOptions{}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -46,9 +44,7 @@ func init() {
|
||||
}
|
||||
|
||||
func restart(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
responses, err := registry.ContainerEngine().PodRestart(context.Background(), args, restartOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -30,9 +30,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
unpauseOptions entities.PodunpauseOptions
|
||||
)
|
||||
var unpauseOptions entities.PodunpauseOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -45,9 +43,7 @@ func init() {
|
||||
}
|
||||
|
||||
func unpause(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
responses, err := registry.ContainerEngine().PodUnpause(context.Background(), args, unpauseOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -16,18 +16,16 @@ import (
|
||||
"go.podman.io/common/pkg/completion"
|
||||
)
|
||||
|
||||
var (
|
||||
createCmd = &cobra.Command{
|
||||
Use: "create [options] NAME FILE|-",
|
||||
Short: "Create a new secret",
|
||||
Long: "Create a secret. Input can be a path to a file or \"-\" (read from stdin). Secret drivers \"file\" (default), \"pass\", and \"shell\" are available.",
|
||||
RunE: create,
|
||||
Args: cobra.ExactArgs(2),
|
||||
Example: `podman secret create mysecret /path/to/secret
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create [options] NAME FILE|-",
|
||||
Short: "Create a new secret",
|
||||
Long: "Create a secret. Input can be a path to a file or \"-\" (read from stdin). Secret drivers \"file\" (default), \"pass\", and \"shell\" are available.",
|
||||
RunE: create,
|
||||
Args: cobra.ExactArgs(2),
|
||||
Example: `podman secret create mysecret /path/to/secret
|
||||
printf "secretdata" | podman secret create mysecret -`,
|
||||
ValidArgsFunction: common.AutocompleteSecretCreate,
|
||||
}
|
||||
)
|
||||
ValidArgsFunction: common.AutocompleteSecretCreate,
|
||||
}
|
||||
|
||||
var (
|
||||
createOpts = entities.SecretCreateOptions{}
|
||||
|
||||
@@ -6,18 +6,16 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
existsCmd = &cobra.Command{
|
||||
Use: "exists SECRET",
|
||||
Short: "Check if a secret exists in local storage",
|
||||
Long: `If the named secret exists in local storage, podman secret exists exits with 0, otherwise the exit code will be 1.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: exists,
|
||||
ValidArgsFunction: common.AutocompleteSecrets,
|
||||
Example: `podman secret exists ID
|
||||
var existsCmd = &cobra.Command{
|
||||
Use: "exists SECRET",
|
||||
Short: "Check if a secret exists in local storage",
|
||||
Long: `If the named secret exists in local storage, podman secret exists exits with 0, otherwise the exit code will be 1.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: exists,
|
||||
ValidArgsFunction: common.AutocompleteSecrets,
|
||||
Example: `podman secret exists ID
|
||||
podman secret exists SECRET || podman secret create SECRET <secret source>`,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -13,17 +13,15 @@ import (
|
||||
"go.podman.io/common/pkg/report"
|
||||
)
|
||||
|
||||
var (
|
||||
inspectCmd = &cobra.Command{
|
||||
Use: "inspect [options] SECRET [SECRET...]",
|
||||
Short: "Inspect a secret",
|
||||
Long: "Display detail information on one or more secrets",
|
||||
RunE: inspect,
|
||||
Example: "podman secret inspect MYSECRET",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteSecrets,
|
||||
}
|
||||
)
|
||||
var inspectCmd = &cobra.Command{
|
||||
Use: "inspect [options] SECRET [SECRET...]",
|
||||
Short: "Inspect a secret",
|
||||
Long: "Display detail information on one or more secrets",
|
||||
RunE: inspect,
|
||||
Example: "podman secret inspect MYSECRET",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteSecrets,
|
||||
}
|
||||
|
||||
var (
|
||||
format string
|
||||
|
||||
@@ -12,15 +12,13 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
rmCmd = &cobra.Command{
|
||||
Use: "rm [options] SECRET [SECRET...]",
|
||||
Short: "Remove one or more secrets",
|
||||
RunE: rm,
|
||||
ValidArgsFunction: common.AutocompleteSecrets,
|
||||
Example: "podman secret rm mysecret1 mysecret2",
|
||||
}
|
||||
)
|
||||
var rmCmd = &cobra.Command{
|
||||
Use: "rm [options] SECRET [SECRET...]",
|
||||
Short: "Remove one or more secrets",
|
||||
RunE: rm,
|
||||
ValidArgsFunction: common.AutocompleteSecrets,
|
||||
Example: "podman secret rm mysecret1 mysecret2",
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -32,14 +30,10 @@ func init() {
|
||||
flags.BoolVarP(&rmOptions.Ignore, "ignore", "i", false, "Ignore errors when a specified secret is missing")
|
||||
}
|
||||
|
||||
var (
|
||||
rmOptions = entities.SecretRmOptions{}
|
||||
)
|
||||
var rmOptions = entities.SecretRmOptions{}
|
||||
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
if (len(args) > 0 && rmOptions.All) || (len(args) < 1 && !rmOptions.All) {
|
||||
return errors.New("`podman secret rm` requires one argument, or the --all flag")
|
||||
}
|
||||
|
||||
@@ -6,15 +6,13 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// Command: podman _secret_
|
||||
secretCmd = &cobra.Command{
|
||||
Use: "secret",
|
||||
Short: "Manage secrets",
|
||||
Long: "Manage secrets",
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
)
|
||||
// Command: podman _secret_
|
||||
var secretCmd = &cobra.Command{
|
||||
Use: "secret",
|
||||
Short: "Manage secrets",
|
||||
Long: "Manage secrets",
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -6,19 +6,17 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// ConnectionCmd skips creating engines (PersistentPreRunE/PersistentPostRunE are No-Op's) since
|
||||
// sub-commands will obtain connection information to said engines
|
||||
ConnectionCmd = &cobra.Command{
|
||||
Use: "connection",
|
||||
Short: "Manage remote API service destinations",
|
||||
Long: `Manage remote API service destination information in podman configuration`,
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
RunE: validate.SubCommandExists,
|
||||
PersistentPostRunE: validate.NoOp,
|
||||
TraverseChildren: false,
|
||||
}
|
||||
)
|
||||
// ConnectionCmd skips creating engines (PersistentPreRunE/PersistentPostRunE are No-Op's) since
|
||||
// sub-commands will obtain connection information to said engines
|
||||
var ConnectionCmd = &cobra.Command{
|
||||
Use: "connection",
|
||||
Short: "Manage remote API service destinations",
|
||||
Long: `Manage remote API service destination information in podman configuration`,
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
RunE: validate.SubCommandExists,
|
||||
PersistentPostRunE: validate.NoOp,
|
||||
TraverseChildren: false,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -10,20 +10,18 @@ import (
|
||||
"go.podman.io/common/pkg/config"
|
||||
)
|
||||
|
||||
var (
|
||||
// Skip creating engines since this command will obtain connection information to said engines
|
||||
renameCmd = &cobra.Command{
|
||||
Use: "rename OLD NEW",
|
||||
Aliases: []string{"mv"},
|
||||
Args: cobra.ExactArgs(2),
|
||||
Short: "Rename \"old\" to \"new\"",
|
||||
Long: `Rename destination for the Podman service from "old" to "new"`,
|
||||
ValidArgsFunction: common.AutocompleteSystemConnections,
|
||||
RunE: rename,
|
||||
Example: `podman system connection rename laptop devl,
|
||||
// Skip creating engines since this command will obtain connection information to said engines
|
||||
var renameCmd = &cobra.Command{
|
||||
Use: "rename OLD NEW",
|
||||
Aliases: []string{"mv"},
|
||||
Args: cobra.ExactArgs(2),
|
||||
Short: "Rename \"old\" to \"new\"",
|
||||
Long: `Rename destination for the Podman service from "old" to "new"`,
|
||||
ValidArgsFunction: common.AutocompleteSystemConnections,
|
||||
RunE: rename,
|
||||
Example: `podman system connection rename laptop devl,
|
||||
podman system connection mv laptop devl`,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -6,20 +6,18 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// ContextCmd skips creating engines (PersistentPreRunE/PersistentPostRunE are No-Op's) since
|
||||
// sub-commands will obtain connection information to said engines
|
||||
ContextCmd = &cobra.Command{
|
||||
Use: "context",
|
||||
Short: "Manage remote API service destinations",
|
||||
Long: `Manage remote API service destination information in podman configuration`,
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
RunE: validate.SubCommandExists,
|
||||
PersistentPostRunE: validate.NoOp,
|
||||
Hidden: true,
|
||||
TraverseChildren: false,
|
||||
}
|
||||
)
|
||||
// ContextCmd skips creating engines (PersistentPreRunE/PersistentPostRunE are No-Op's) since
|
||||
// sub-commands will obtain connection information to said engines
|
||||
var ContextCmd = &cobra.Command{
|
||||
Use: "context",
|
||||
Short: "Manage remote API service destinations",
|
||||
Long: `Manage remote API service destination information in podman configuration`,
|
||||
PersistentPreRunE: validate.NoOp,
|
||||
RunE: validate.SubCommandExists,
|
||||
PersistentPostRunE: validate.NoOp,
|
||||
Hidden: true,
|
||||
TraverseChildren: false,
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -34,9 +34,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
dfOptions entities.SystemDfOptions
|
||||
)
|
||||
var dfOptions entities.SystemDfOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -2,12 +2,11 @@ package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"errors"
|
||||
|
||||
"github.com/containers/podman/v6/cmd/podman/registry"
|
||||
"github.com/containers/podman/v6/cmd/podman/validate"
|
||||
"github.com/containers/podman/v6/pkg/bindings"
|
||||
@@ -15,18 +14,16 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
dialStdioCommand = &cobra.Command{
|
||||
Use: "dial-stdio",
|
||||
Short: "Proxy the stdio stream to the daemon connection. Should not be invoked manually.",
|
||||
Args: validate.NoArgs,
|
||||
Hidden: true,
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return runDialStdio()
|
||||
},
|
||||
Example: "podman system dial-stdio",
|
||||
}
|
||||
)
|
||||
var dialStdioCommand = &cobra.Command{
|
||||
Use: "dial-stdio",
|
||||
Short: "Proxy the stdio stream to the daemon connection. Should not be invoked manually.",
|
||||
Args: validate.NoArgs,
|
||||
Hidden: true,
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return runDialStdio()
|
||||
},
|
||||
Example: "podman system dial-stdio",
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -8,18 +8,16 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
locksCommand = &cobra.Command{
|
||||
Use: "locks",
|
||||
Short: "Debug Libpod's use of locks, identifying any potential conflicts",
|
||||
Args: validate.NoArgs,
|
||||
Hidden: true,
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return runLocks()
|
||||
},
|
||||
Example: "podman system locks",
|
||||
}
|
||||
)
|
||||
var locksCommand = &cobra.Command{
|
||||
Use: "locks",
|
||||
Short: "Debug Libpod's use of locks, identifying any potential conflicts",
|
||||
Args: validate.NoArgs,
|
||||
Hidden: true,
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return runLocks()
|
||||
},
|
||||
Example: "podman system locks",
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
@@ -27,6 +25,7 @@ func init() {
|
||||
Parent: systemCmd,
|
||||
})
|
||||
}
|
||||
|
||||
func runLocks() error {
|
||||
report, err := registry.ContainerEngine().Locks(registry.Context())
|
||||
if err != nil {
|
||||
|
||||
@@ -31,9 +31,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
migrateOptions entities.SystemMigrateOptions
|
||||
)
|
||||
var migrateOptions entities.SystemMigrateOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -16,13 +16,13 @@ type OutputErrors []error
|
||||
|
||||
func (o OutputErrors) PrintErrors() (lastError error) {
|
||||
if len(o) == 0 {
|
||||
return
|
||||
return lastError
|
||||
}
|
||||
lastError = o[len(o)-1]
|
||||
for e := 0; e < len(o)-1; e++ {
|
||||
fmt.Fprintf(os.Stderr, "Error: %s\n", o[e])
|
||||
}
|
||||
return
|
||||
return lastError
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,9 +71,7 @@ func init() {
|
||||
}
|
||||
|
||||
func create(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
var err error
|
||||
if len(args) > 0 {
|
||||
createOpts.Name = args[0]
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ Allow content of volume to be exported into external tar.`
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
targetPath string
|
||||
)
|
||||
var targetPath string
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -27,9 +27,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
inspectOpts *entities.InspectOptions
|
||||
)
|
||||
var inspectOpts *entities.InspectOptions
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
|
||||
@@ -51,9 +51,7 @@ func init() {
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
var errs utils.OutputErrors
|
||||
if (len(args) > 0 && rmOptions.All) || (len(args) < 1 && !rmOptions.All) {
|
||||
return errors.New("choose either one or more volumes or all")
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ var (
|
||||
kmsgFile *os.File
|
||||
)
|
||||
|
||||
var (
|
||||
void struct{}
|
||||
)
|
||||
var void struct{}
|
||||
|
||||
// We log directly to /dev/kmsg, because that is the only way to get information out
|
||||
// of the generator into the system logs.
|
||||
@@ -146,7 +144,7 @@ func loadUnitDropins(unit *parser.UnitFile, sourcePaths []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
var dropinPaths = make(map[string]string)
|
||||
dropinPaths := make(map[string]string)
|
||||
for _, dropinDir := range dropinDirs {
|
||||
dropinFiles, err := os.ReadDir(dropinDir)
|
||||
if err != nil {
|
||||
|
||||
@@ -478,7 +478,8 @@ func (c *Container) execStartAndAttach(sessionID string, streams *define.AttachS
|
||||
// ExecHTTPStartAndAttach starts and performs an HTTP attach to an exec session.
|
||||
// newSize resizes the tty to this size before the process is started, must be nil if the exec session has no tty
|
||||
func (c *Container) ExecHTTPStartAndAttach(sessionID string, r *http.Request, w http.ResponseWriter,
|
||||
streams *HTTPAttachStreams, _ *string, cancel <-chan bool, hijackDone chan<- bool, newSize *resize.TerminalSize) error {
|
||||
streams *HTTPAttachStreams, _ *string, cancel <-chan bool, hijackDone chan<- bool, newSize *resize.TerminalSize,
|
||||
) error {
|
||||
// TODO: How do we combine streams with the default streams set in the exec session?
|
||||
|
||||
// Ensure that we don't leak a goroutine here
|
||||
@@ -1016,9 +1017,9 @@ func (c *Container) cleanupExecBundle(sessionID string) (err error) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
return
|
||||
return err
|
||||
}
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
// the path to a container's exec session bundle
|
||||
|
||||
@@ -61,7 +61,7 @@ import (
|
||||
const (
|
||||
// name of the directory holding the artifacts
|
||||
artifactsDir = "artifacts"
|
||||
execDirPermission = 0755
|
||||
execDirPermission = 0o755
|
||||
preCheckpointDir = "pre-checkpoint"
|
||||
)
|
||||
|
||||
@@ -681,7 +681,7 @@ func (c *Container) refresh() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Chmod(c.runtime.config.Engine.TmpDir, info.Mode()|0111); err != nil {
|
||||
if err := os.Chmod(c.runtime.config.Engine.TmpDir, info.Mode()|0o111); err != nil {
|
||||
return err
|
||||
}
|
||||
root := filepath.Join(c.runtime.config.Engine.TmpDir, "containers-root", c.ID())
|
||||
@@ -1799,7 +1799,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
|
||||
return "", fmt.Errorf("unable to get host UID and host GID: %w", err)
|
||||
}
|
||||
|
||||
//note: this should not be recursive, if using external rootfs users should be responsible on configuring ownership.
|
||||
// note: this should not be recursive, if using external rootfs users should be responsible on configuring ownership.
|
||||
if err := chown.ChangeHostPathOwnership(mountPoint, false, int(hostUID), int(hostGID)); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -338,7 +338,8 @@ func (c *Container) generateSpec(ctx context.Context) (s *spec.Spec, cleanupFunc
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
overlayOpts = &overlay.Options{RootUID: c.RootUID(),
|
||||
overlayOpts = &overlay.Options{
|
||||
RootUID: c.RootUID(),
|
||||
RootGID: c.RootGID(),
|
||||
UpperDirOptionFragment: upperDir,
|
||||
WorkDirOptionFragment: workDir,
|
||||
@@ -471,7 +472,8 @@ func (c *Container) generateSpec(ctx context.Context) (s *spec.Spec, cleanupFunc
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
overlayOpts := &overlay.Options{RootUID: c.RootUID(),
|
||||
overlayOpts := &overlay.Options{
|
||||
RootUID: c.RootUID(),
|
||||
RootGID: c.RootGID(),
|
||||
UpperDirOptionFragment: upperDir,
|
||||
WorkDirOptionFragment: workDir,
|
||||
@@ -1267,7 +1269,6 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {
|
||||
IncludeSourceDir: true,
|
||||
IncludeFiles: includeFiles,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("reading checkpoint directory %q: %w", c.ID(), err)
|
||||
}
|
||||
@@ -2023,7 +2024,6 @@ func (c *Container) makeBindMounts() error {
|
||||
resolvPath, exists := bindMounts[resolvconf.DefaultResolvConf]
|
||||
if !c.config.UseImageResolvConf && exists {
|
||||
err := c.mountIntoRootDirs(resolvconf.DefaultResolvConf, resolvPath)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("assigning mounts to container %s: %w", c.ID(), err)
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var (
|
||||
bindOptions = []string{}
|
||||
)
|
||||
var bindOptions = []string{}
|
||||
|
||||
func (c *Container) mountSHM(_ string) error {
|
||||
return nil
|
||||
|
||||
@@ -30,9 +30,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var (
|
||||
bindOptions = []string{define.TypeBind, "rprivate"}
|
||||
)
|
||||
var bindOptions = []string{define.TypeBind, "rprivate"}
|
||||
|
||||
func (c *Container) mountSHM(shmOptions string) error {
|
||||
contextType := "context"
|
||||
|
||||
@@ -31,7 +31,8 @@ func init() {
|
||||
}
|
||||
|
||||
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions,
|
||||
logChannel chan *logs.LogLine, colorID int64, passthroughUnit string) error {
|
||||
logChannel chan *logs.LogLine, colorID int64, passthroughUnit string,
|
||||
) error {
|
||||
// We need the container's events in the same journal to guarantee
|
||||
// consistency, see #10323.
|
||||
if options.Follow && c.runtime.config.Engine.EventsLogger != "journald" {
|
||||
|
||||
@@ -7,7 +7,5 @@ const (
|
||||
TypeBind = "nullfs"
|
||||
)
|
||||
|
||||
var (
|
||||
// Mount potions for bind
|
||||
BindOptions = []string{}
|
||||
)
|
||||
// Mount potions for bind
|
||||
var BindOptions = []string{}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user