Skip to content

Commit

Permalink
Allow matching shim path side by side with containerd
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
  • Loading branch information
jterry75 committed Jan 28, 2019
1 parent 764afa0 commit d63099c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
14 changes: 13 additions & 1 deletion runtime/v2/shim/util.go
Expand Up @@ -63,7 +63,19 @@ func Command(ctx context.Context, runtime, containerdAddress, path string, cmdAr
if cmdPath, lerr = exec.LookPath(name); lerr != nil {
if eerr, ok := lerr.(*exec.Error); ok {
if eerr.Err == exec.ErrNotFound {
return nil, errors.Wrapf(os.ErrNotExist, "runtime %q binary not installed %q", runtime, name)
// LookPath only finds current directory matches based on
// the callers current directory but the caller is not
// likely in the same directory as the containerd
// executables. Instead match the calling binaries path
// (containerd) and see if they are side by side. If so
// execute the shim found there.
testPath := filepath.Join(filepath.Dir(self), name)
if _, serr := os.Stat(testPath); serr == nil {
path = testPath
}
if path == "" {
return nil, errors.Wrapf(os.ErrNotExist, "runtime %q binary not installed %q", runtime, name)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Expand Up @@ -33,7 +33,7 @@ golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c
github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0
github.com/Microsoft/go-winio v0.4.11
github.com/Microsoft/hcsshim v0.8.4
github.com/Microsoft/hcsshim v0.8.5
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
github.com/containerd/ttrpc f02858b1457c5ca3aaec3a0803eb0d59f96e41d6
Expand Down
19 changes: 16 additions & 3 deletions vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d63099c

Please sign in to comment.