update delete file
This commit is contained in:
parent
51aa9cb67f
commit
cc8e04a41f
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,7 +7,7 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
tmp
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
@ -23,4 +23,4 @@ go.work.sum
|
||||
|
||||
# env file
|
||||
.env
|
||||
.idea
|
||||
.idea
|
||||
|
||||
6
go.mod
6
go.mod
@ -99,6 +99,7 @@ require (
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.1-0.20241109141217-c266b19b28e9 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
@ -107,6 +108,7 @@ require (
|
||||
github.com/google/go-containerregistry v0.20.2 // indirect
|
||||
github.com/google/go-intervals v0.0.2 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/handlers v1.5.2 // indirect
|
||||
@ -152,6 +154,7 @@ require (
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/nxadm/tail v1.4.11 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.22.2 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0 // indirect
|
||||
github.com/opencontainers/runc v1.2.4 // indirect
|
||||
@ -168,6 +171,7 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/proglottis/gpgme v0.1.4 // indirect
|
||||
github.com/quic-go/quic-go v0.50.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/seccomp/libseccomp-golang v0.10.0 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
|
||||
@ -200,6 +204,7 @@ require (
|
||||
go.opentelemetry.io/otel v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.31.0 // indirect
|
||||
go.uber.org/mock v0.5.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.35.0 // indirect
|
||||
@ -212,6 +217,7 @@ require (
|
||||
golang.org/x/term v0.29.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
golang.org/x/time v0.9.0 // indirect
|
||||
golang.org/x/tools v0.28.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
|
||||
google.golang.org/grpc v1.69.4 // indirect
|
||||
google.golang.org/protobuf v1.36.3 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@ -426,6 +426,8 @@ github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVho
|
||||
github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/quic-go/quic-go v0.50.1 h1:unsgjFIUqW8a2oopkY7YNONpV1gYND6Nt9hnt1PN94Q=
|
||||
github.com/quic-go/quic-go v0.50.1/go.mod h1:Vim6OmUvlYdwBhXP9ZVrtGmCMWa3wEqhq3NgYrI8b4E=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
@ -557,6 +559,8 @@ go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeX
|
||||
go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
|
||||
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
|
||||
1
main.go
1
main.go
@ -65,6 +65,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
listener, err := net.Listen("tcp", "127.0.0.1:8888")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
98
root.go
98
root.go
@ -11,10 +11,8 @@ import (
|
||||
"github.com/containers/common/pkg/ssh"
|
||||
"github.com/containers/podman/v5/cmd/podman/common"
|
||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||
"github.com/containers/podman/v5/libpod/define"
|
||||
"github.com/containers/podman/v5/pkg/bindings"
|
||||
"github.com/containers/podman/v5/pkg/domain/entities"
|
||||
"github.com/containers/storage"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/yaml"
|
||||
@ -223,10 +221,6 @@ func setupRemoteConnection(podmanConfig *entities.PodmanConfig) string {
|
||||
|
||||
func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
logrus.Debugf("Called %s.PersistentPreRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
|
||||
|
||||
// Help, completion and commands with subcommands are special cases, no need for more setup
|
||||
// Completion cmd is used to generate the shell scripts
|
||||
|
||||
podmanConfig := registry.PodmanConfig()
|
||||
log.Println(*podmanConfig)
|
||||
if !registry.IsRemote() {
|
||||
@ -234,40 +228,12 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
podmanConfig.ContainersConf.Engine.HooksDir.Set(podmanConfig.HooksDir)
|
||||
}
|
||||
|
||||
// Currently it is only possible to restore a container with the same runtime
|
||||
// as used for checkpointing. It should be possible to make crun and runc
|
||||
// compatible to restore a container with another runtime then checkpointed.
|
||||
// Currently that does not work.
|
||||
// To make it easier for users we will look into the checkpoint archive and
|
||||
// set the runtime to the one used during checkpointing.
|
||||
|
||||
}
|
||||
|
||||
if err := readRemoteCliFlags(cmd, podmanConfig); err != nil {
|
||||
return fmt.Errorf("read cli flags: %w", err)
|
||||
}
|
||||
|
||||
// Special case if command is hidden completion command ("__complete","__completeNoDesc")
|
||||
// Since __completeNoDesc is an alias the cm.Name is always __complete
|
||||
//if cmd.Name() == cobra.ShellCompRequestCmd {
|
||||
// // Parse the cli arguments after the completion cmd (always called as second argument)
|
||||
// // This ensures that the --url, --identity and --connection flags are properly set
|
||||
// compCmd, _, err := cmd.Root().Traverse(os.Args[2:])
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// // If we don't complete the root cmd hide all root flags
|
||||
// // so they won't show up in the completions on subcommands.
|
||||
// if compCmd != compCmd.Root() {
|
||||
// compCmd.Root().Flags().VisitAll(func(flag *pflag.Flag) {
|
||||
// flag.Hidden = true
|
||||
// })
|
||||
// }
|
||||
// // No need for further setup the completion logic setups the engines as needed.
|
||||
// requireCleanup = false
|
||||
// return nil
|
||||
//}
|
||||
|
||||
c := &cobra.Command{}
|
||||
// Prep the engines
|
||||
if _, err := registry.NewImageEngine(c, args); err != nil {
|
||||
@ -286,7 +252,6 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Hard code TMPDIR functions to use /var/tmp, if user did not override
|
||||
if _, ok := os.LookupEnv("TMPDIR"); !ok {
|
||||
if tmpdir, err := podmanConfig.ContainersConfDefaultsRO.ImageCopyTmpDir(); err != nil {
|
||||
logrus.Warnf("Failed to retrieve default tmp dir: %s", err.Error())
|
||||
@ -295,39 +260,6 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
//if !registry.IsRemote() {
|
||||
// if c.Flag("cpu-profile").Changed {
|
||||
// f, err := os.Create(podmanConfig.CPUProfile)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// if err := pprof.StartCPUProfile(f); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// }
|
||||
// if c.Flag("memory-profile").Changed {
|
||||
// // Same value as the default in github.com/pkg/profile.
|
||||
// runtime.MemProfileRate = 4096
|
||||
// if rate := os.Getenv("MemProfileRate"); rate != "" {
|
||||
// r, err := strconv.Atoi(rate)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// runtime.MemProfileRate = r
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if podmanConfig.MaxWorks <= 0 {
|
||||
// return fmt.Errorf("maximum workers must be set to a positive number (got %d)", podmanConfig.MaxWorks)
|
||||
// }
|
||||
// if err := parallel.SetMaxThreads(uint(podmanConfig.MaxWorks)); err != nil {
|
||||
// return err
|
||||
// }
|
||||
//}
|
||||
// Setup Rootless environment, IFF:
|
||||
// 1) in ABI mode
|
||||
// 2) running as non-root
|
||||
// 3) command doesn't require Parent Namespace
|
||||
_, found := c.Annotations[registry.ParentNSRequired]
|
||||
if !registry.IsRemote() && !found {
|
||||
cgroupMode := ""
|
||||
@ -444,14 +376,9 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||
}
|
||||
podmanConfig.Remote = true
|
||||
} else {
|
||||
// The --module's are actually used and parsed in
|
||||
// `registry.PodmanConfig()`. But we also need to expose them
|
||||
// as a flag here to a) make sure that rootflags are aware of
|
||||
// this flag and b) to have shell completions.
|
||||
moduleFlagName := "module"
|
||||
lFlags.StringArray(moduleFlagName, nil, "Load the containers.conf(5) module")
|
||||
|
||||
// A *hidden* flag to change the database backend.
|
||||
pFlags.StringVar(&podmanConfig.ContainersConf.Engine.DBBackend, "db-backend", podmanConfig.ContainersConfDefaultsRO.Engine.DBBackend, "Database backend to use")
|
||||
|
||||
cgroupManagerFlagName := "cgroup-manager"
|
||||
@ -514,7 +441,7 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||
tmpdirFlagName := "tmpdir"
|
||||
pFlags.StringVar(&podmanConfig.ContainersConf.Engine.TmpDir, tmpdirFlagName, podmanConfig.ContainersConfDefaultsRO.Engine.TmpDir, "Path to the tmp directory for libpod state content.\n\nNote: use the environment variable 'TMPDIR' to change the temporary storage location for container images, '/var/tmp'.\n")
|
||||
|
||||
pFlags.BoolVar(&podmanConfig.Trace, "trace", false, "Enable opentracing output (default false)")
|
||||
pFlags.BoolVar(&podmanConfig.Trace, "trace", true, "Enable opentracing output (default false)")
|
||||
|
||||
volumePathFlagName := "volumepath"
|
||||
pFlags.StringVar(&podmanConfig.ContainersConf.Engine.VolumePath, volumePathFlagName, podmanConfig.ContainersConfDefaultsRO.Engine.VolumePath, "Path to the volume directory in which volume data is stored")
|
||||
@ -556,26 +483,3 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||
pFlags.BoolVar(&podmanConfig.Syslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
|
||||
}
|
||||
}
|
||||
|
||||
func formatError(err error) string {
|
||||
var message string
|
||||
switch {
|
||||
case errors.Is(err, define.ErrOCIRuntime):
|
||||
// OCIRuntimeErrors include the reason for the failure in the
|
||||
// second to last message in the error chain.
|
||||
message = fmt.Sprintf(
|
||||
"Error: %s: %s",
|
||||
define.ErrOCIRuntime.Error(),
|
||||
strings.TrimSuffix(err.Error(), ": "+define.ErrOCIRuntime.Error()),
|
||||
)
|
||||
case errors.Is(err, storage.ErrDuplicateName):
|
||||
message = fmt.Sprintf("Error: %s, or use --replace to instruct Podman to do so.", err.Error())
|
||||
default:
|
||||
if logrus.IsLevelEnabled(logrus.TraceLevel) {
|
||||
message = fmt.Sprintf("Error: %+v", err)
|
||||
} else {
|
||||
message = fmt.Sprintf("Error: %v", err)
|
||||
}
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
BIN
tmp/runner-build
BIN
tmp/runner-build
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user