Skip to content

Commit

Permalink
don't look in host path for thin_ls binary
Browse files Browse the repository at this point in the history
  • Loading branch information
sjenning committed Feb 3, 2017
1 parent c30a9e7 commit cd41c0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ENV GLIBC_VERSION "2.23-r3"

RUN apk --no-cache add ca-certificates wget device-mapper && \
apk --no-cache add zfs --repository http://dl-3.alpinelinux.org/alpine/edge/main/ && \
apk --no-cache add thin-provisioning-tools --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \
wget https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk && \
Expand Down
15 changes: 2 additions & 13 deletions devicemapper/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ import (
// ThinLsBinaryPresent returns the location of the thin_ls binary in the mount
// namespace cadvisor is running in or an error. The locations checked are:
//
// - /sbin/
// - /bin/
// - /usr/sbin/
// - /usr/bin/
//
// ThinLsBinaryPresent checks these paths relative to:
//
// 1. For non-containerized operation - `/`
// 2. For containerized operation - `/rootfs`
//
// The thin_ls binary is provided by the device-mapper-persistent-data
// package.
func ThinLsBinaryPresent() (string, error) {
Expand All @@ -39,21 +35,14 @@ func ThinLsBinaryPresent() (string, error) {
err error
)

for _, path := range []string{"/bin", "/usr/sbin/", "/usr/bin"} {
for _, path := range []string{"/sbin", "/bin", "/usr/sbin/", "/usr/bin"} {
// try paths for non-containerized operation
// note: thin_ls is most likely a symlink to pdata_tools
thinLsPath = filepath.Join(path, "thin_ls")
_, err = os.Stat(thinLsPath)
if err == nil {
return thinLsPath, nil
}

// try paths for containerized operation
thinLsPath = filepath.Join("/rootfs", thinLsPath)
_, err = os.Stat(thinLsPath)
if err == nil {
return thinLsPath, nil
}
}

return "", fmt.Errorf("unable to find thin_ls binary")
Expand Down

0 comments on commit cd41c0b

Please sign in to comment.