Skip to content

Commit 6becad2

Browse files
Merge pull request cri-o#5245 from haircommander/exec-revert
oci: use conmon for exec again
2 parents 5d5a754 + 6a8cb41 commit 6becad2

File tree

6 files changed

+308
-429
lines changed

6 files changed

+308
-429
lines changed

internal/dirnotifier/dirnotifier.go

Lines changed: 0 additions & 61 deletions
This file was deleted.

internal/dirnotifier/dirnotifier_test.go

Lines changed: 0 additions & 64 deletions
This file was deleted.

internal/dirnotifier/suite_test.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

internal/oci/oci.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package oci
22

33
import (
4+
"bytes"
45
"fmt"
56
"io"
67
"os"
@@ -10,10 +11,8 @@ import (
1011
"syscall"
1112
"time"
1213

13-
"github.com/cri-o/cri-o/internal/dirnotifier"
1414
"github.com/cri-o/cri-o/pkg/config"
1515
"github.com/cri-o/cri-o/server/cri/types"
16-
"github.com/fsnotify/fsnotify"
1716
rspec "github.com/opencontainers/runtime-spec/specs-go"
1817
"github.com/pkg/errors"
1918
"golang.org/x/net/context"
@@ -44,7 +43,6 @@ type Runtime struct {
4443
config *config.Config
4544
runtimeImplMap map[string]RuntimeImpl
4645
runtimeImplMapMutex sync.RWMutex
47-
execNotifier *dirnotifier.DirectoryNotifier
4846
}
4947

5048
// RuntimeImpl is an interface used by the caller to interact with the
@@ -83,14 +81,9 @@ func New(c *config.Config) (*Runtime, error) {
8381
return nil, errors.Wrapf(err, "create oci runtime pid dir")
8482
}
8583

86-
notifier, err := dirnotifier.New(execNotifyDir, fsnotify.Write, fsnotify.Rename)
87-
if err != nil {
88-
return nil, err
89-
}
9084
return &Runtime{
9185
config: c,
9286
runtimeImplMap: make(map[string]RuntimeImpl),
93-
execNotifier: notifier,
9487
}, nil
9588
}
9689

@@ -433,6 +426,18 @@ func (r *Runtime) ReopenContainerLog(ctx context.Context, c *Container) error {
433426
return impl.ReopenContainerLog(ctx, c)
434427
}
435428

429+
// ExecSyncError wraps command's streams, exit code and error on ExecSync error.
430+
type ExecSyncError struct {
431+
Stdout bytes.Buffer
432+
Stderr bytes.Buffer
433+
ExitCode int32
434+
Err error
435+
}
436+
437+
func (e *ExecSyncError) Error() string {
438+
return fmt.Sprintf("command error: %+v, stdout: %s, stderr: %s, exit code %d", e.Err, e.Stdout.Bytes(), e.Stderr.Bytes(), e.ExitCode)
439+
}
440+
436441
// BuildContainerdBinaryName() is responsible for ensuring the binary passed will
437442
// be properly converted to the containerd binary naming pattern.
438443
//

0 commit comments

Comments
 (0)