Skip to content

Commit 3eca11c

Browse files
committed
more debug info
1 parent 00a3cb5 commit 3eca11c

File tree

7 files changed

+143
-124
lines changed

7 files changed

+143
-124
lines changed

apps/docker-slim-sensor/artifacts.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import (
2323
)
2424

2525
const (
26-
pycExt = ".pyc"
27-
pyoExt = ".pyo"
28-
pycacheDir = "/__pycache__/"
29-
pycache = "__pycache__"
30-
defaultReportName = "creport.json"
26+
pycExt = ".pyc"
27+
pyoExt = ".pyo"
28+
pycacheDir = "/__pycache__/"
29+
pycache = "__pycache__"
30+
defaultReportName = "creport.json"
3131
defaultArtifactDirName = "/opt/dockerslim/artifacts"
3232
)
3333

@@ -182,7 +182,7 @@ func (p *artifactStore) saveArtifacts() {
182182
}
183183

184184
var paths map[string]bool
185-
for _,pathValue := range pathList {
185+
for _, pathValue := range pathList {
186186
pathInfo, err := os.Stat(pathValue)
187187
if err != nil {
188188
log.Debug("saveArtifacts.preparePaths(): skipping path = ", pathValue)
@@ -201,8 +201,8 @@ func (p *artifactStore) saveArtifacts() {
201201

202202
includePaths = preparePaths(p.cmd.Includes)
203203
excludePaths = preparePaths(p.cmd.Excludes)
204-
log.Debugf("includePaths: %+v\n",includePaths)
205-
log.Debugf("excludePaths: %+v\n",excludePaths)
204+
log.Debugf("includePaths: %+v\n", includePaths)
205+
log.Debugf("excludePaths: %+v\n", excludePaths)
206206

207207
//TODO: use exludePaths to filter discovered files
208208
for fileName := range p.fileMap {
@@ -242,17 +242,17 @@ func (p *artifactStore) saveArtifacts() {
242242
for inPath, isDir := range includePaths {
243243
dstPath := fmt.Sprintf("%s/files%s", p.storeLocation, inPath)
244244
if isDir {
245-
err, errs := utils.CopyDir(inPath,dstPath,true,true,nil,nil,nil)
246-
if err != nil {
247-
log.Warnf("CopyDir(%v,%v) error: %v\n",inPath,dstPath,err)
248-
}
249-
250-
if len(errs) > 0 {
251-
log.Warnf("CopyDir(%v,%v) copy errors: %+v\n",inPath,dstPath,errs)
252-
}
245+
err, errs := utils.CopyDir(inPath, dstPath, true, true, nil, nil, nil)
246+
if err != nil {
247+
log.Warnf("CopyDir(%v,%v) error: %v\n", inPath, dstPath, err)
248+
}
249+
250+
if len(errs) > 0 {
251+
log.Warnf("CopyDir(%v,%v) copy errors: %+v\n", inPath, dstPath, errs)
252+
}
253253
} else {
254-
if err := utils.CopyFile(inPath,dstPath,true); err != nil {
255-
log.Warnf("CopyFile(%v,%v) error: %v\n",inPath,dstPath,err)
254+
if err := utils.CopyFile(inPath, dstPath, true); err != nil {
255+
log.Warnf("CopyFile(%v,%v) error: %v\n", inPath, dstPath, err)
256256
}
257257
}
258258
}

apps/docker-slim-sensor/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func main() {
8686
log.Infof("sensor: args => %#v\n", os.Args)
8787

8888
dirName, err := os.Getwd()
89-
utils.FailOn(err)
89+
utils.WarnOn(err)
9090
log.Debugf("sensor: cwd => %#v\n", dirName)
9191

9292
initSignalHandlers()

apps/docker-slim/cli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/cloudimmunity/docker-slim/consts"
78
"github.com/cloudimmunity/docker-slim/master/commands"
89
"github.com/cloudimmunity/docker-slim/master/config"
9-
"github.com/cloudimmunity/docker-slim/consts"
1010

1111
log "github.com/Sirupsen/logrus"
1212
"github.com/codegangsta/cli"
@@ -21,7 +21,7 @@ var app *cli.App
2121

2222
func init() {
2323
app = cli.NewApp()
24-
app.Version = fmt.Sprintf("%v|%v|%v|%v",consts.APP_VERSION_NAME,appVersionTag,appVersionRev,appVersionTime)
24+
app.Version = fmt.Sprintf("%v|%v|%v|%v", consts.APP_VERSION_NAME, appVersionTag, appVersionRev, appVersionTime)
2525
app.Name = APP_NAME
2626
app.Usage = APP_USAGE
2727
app.CommandNotFound = func(ctx *cli.Context, command string) {

apps/docker-slim/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
var (
4-
appVersionTag = "latest"
5-
appVersionRev = "latest"
4+
appVersionTag = "latest"
5+
appVersionRev = "latest"
66
appVersionTime = "latest"
77
)

master/inspectors/container/container_inspector.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"os"
88
"path/filepath"
9+
"time"
910

1011
"github.com/cloudimmunity/docker-slim/master/config"
1112
"github.com/cloudimmunity/docker-slim/master/docker/dockerhost"
@@ -23,6 +24,7 @@ import (
2324
type Inspector struct {
2425
ContainerInfo *dockerapi.Container
2526
ContainerID string
27+
ContainerName string
2628
FatContainerCmd []string
2729
LocalVolumePath string
2830
CmdPort dockerapi.Port
@@ -121,8 +123,10 @@ func (i *Inspector) RunContainer() error {
121123
containerCmd = append(containerCmd, "-d")
122124
}
123125

126+
i.ContainerName = fmt.Sprintf("dockerslimk_%v_%v", os.Getpid(), time.Now().UTC().Format("20060102150405"))
127+
124128
containerOptions := dockerapi.CreateContainerOptions{
125-
Name: "dockerslimk",
129+
Name: i.ContainerName,
126130
Config: &dockerapi.Config{
127131
Image: i.ImageInspector.ImageRef,
128132
ExposedPorts: map[dockerapi.Port]struct{}{

0 commit comments

Comments
 (0)