Skip to content

Commit

Permalink
Merge pull request #805 from tejal29/fix_720
Browse files Browse the repository at this point in the history
add debug level info what is the layer type
  • Loading branch information
tejal29 authored Oct 4, 2019
2 parents 743a967 + 1a88d7a commit 529bc4f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/util/fs_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"archive/tar"
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -82,19 +83,25 @@ func GetFSFromImage(root string, img v1.Image) ([]string, error) {
extractedFiles := []string{}

for i, l := range layers {
logrus.Debugf("Extracting layer %d", i)
if mediaType, err := l.MediaType(); err == nil {
logrus.Debugf("Extracting layer %d of media type %s", mediaType)
} else {
logrus.Debugf("Extracting layer %d", i)
}

r, err := l.Uncompressed()
if err != nil {
return nil, err
}
defer r.Close()
tr := tar.NewReader(r)
for {
hdr, err := tr.Next()
if err == io.EOF {
break
}
if err != nil {
return nil, err
return nil, errors.Wrap(err, fmt.Sprintf("error reading tar %d", i))
}
path := filepath.Join(root, filepath.Clean(hdr.Name))
base := filepath.Base(path)
Expand Down

0 comments on commit 529bc4f

Please sign in to comment.