shim: enable debug logging for delete
Signed-off-by: Samuel Karp <samuelkarp@google.com>
This commit is contained in:
parent
54ec1919f3
commit
515d68099b
@ -26,6 +26,9 @@ import (
|
||||
gruntime "runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/ttrpc"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/containerd/containerd/api/runtime/task/v2"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
@ -34,8 +37,6 @@ import (
|
||||
"github.com/containerd/containerd/protobuf/types"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
client "github.com/containerd/containerd/runtime/v2/shim"
|
||||
"github.com/containerd/ttrpc"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type shimBinaryConfig struct {
|
||||
@ -153,6 +154,15 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
|
||||
if gruntime.GOOS != "windows" && gruntime.GOOS != "freebsd" {
|
||||
bundlePath = b.bundle.Path
|
||||
}
|
||||
args := []string{
|
||||
"-id", b.bundle.ID,
|
||||
"-bundle", b.bundle.Path,
|
||||
}
|
||||
switch logrus.GetLevel() {
|
||||
case logrus.DebugLevel, logrus.TraceLevel:
|
||||
args = append(args, "-debug")
|
||||
}
|
||||
args = append(args, "delete")
|
||||
|
||||
cmd, err := client.Command(ctx,
|
||||
&client.CommandConfig{
|
||||
@ -161,11 +171,7 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
|
||||
TTRPCAddress: b.containerdTTRPCAddress,
|
||||
Path: bundlePath,
|
||||
Opts: nil,
|
||||
Args: []string{
|
||||
"-id", b.bundle.ID,
|
||||
"-bundle", b.bundle.Path,
|
||||
"delete",
|
||||
},
|
||||
Args: args,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -312,6 +312,9 @@ func run(ctx context.Context, manager Manager, initFunc Init, name string, confi
|
||||
// Handle explicit actions
|
||||
switch action {
|
||||
case "delete":
|
||||
if debugFlag {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
logger := log.G(ctx).WithFields(logrus.Fields{
|
||||
"pid": os.Getpid(),
|
||||
"namespace": namespaceFlag,
|
||||
|
Loading…
Reference in New Issue
Block a user