Skip to content

Commit

Permalink
ports log error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
logeshkrish committed Jan 14, 2021
1 parent 45b3c56 commit 425e20f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ vendor/
sail
Dockerfile
*.log
cmd/sail
cmd/folder.*
Binary file modified cmd/folder.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions cmd/sail.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ func main() {
log.Println("Docker creating...")
if _, err := trace.DockerCreate_noreq(osname, osver, "final", requestID, *dockerizeTextPtr); err != nil {
log.Println("Docker container creation failed :", err.Error())
os.Exit(1)
// os.Exit(1)
}
log.Println("Docker creating completed")

//Docker Copy
log.Println("Docker file copying ...")
if _, err := trace.DockerCopy_noreq(dir, requestID); err != nil {
log.Println("Docker file copy failed :", err.Error())
os.Exit(1)
// os.Exit(1)
}
log.Println("Docker file copying completed")
log.Println("Copying fmt file of trace to container...")
Expand Down
12 changes: 6 additions & 6 deletions trace/dockerUtils/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ CMD /bin/bash`, os_details.Osname, os_details.Osver)
func CompressCopy(filename string, slog *logrus.Entry) error {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
slog.Print("File does not exist.")
slog.Print("there is nothing to copy.")
return err
}

Expand All @@ -166,7 +166,7 @@ func CompressCopy(filename string, slog *logrus.Entry) error {
} else {
copy_file := fmt.Sprintf("docker cp %s dev:%s", filename, filename)
if _, err = cmd.ExecuteAsScript(copy_file, "trace.dockerUtils Error : docker file copy failed"); err != nil {
return err
// return err
}
}
return nil
Expand Down Expand Up @@ -327,16 +327,16 @@ func FinalImage(user string, workdir string, imagename string, slog *logrus.Entr
}

if _, err = cmd.ExecuteAsScript("docker build -t "+imagename+" .", "trace.dockerUtils Error : docker final build failed"); err != nil {
return err
// return err
}
if _, err = cmd.ExecuteAsScript("docker create -it --name "+imagename+" "+imagename, "trace.dockerUtils Error : docker final create failed"); err != nil {
return err
// return err
}
if _, err = cmd.ExecuteAsScript("docker start "+imagename, "trace.dockerUtils Error : docker final start failed"); err != nil {
return err
// return err
}
if _, err = cmd.ExecuteAsScript("docker commit "+imagename+" "+imagename, "trace.dockerUtils Error : docker final commit failed"); err != nil {
return err
// return err
}
return nil
}
3 changes: 2 additions & 1 deletion trace/startTrace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ func ENVList(pid string, slog *logrus.Entry) error {
func PortList(delay int, pid string, slog *logrus.Entry) (Network, error) {
networks := Network{}
command := fmt.Sprintf("netstat -ntlp | grep %s > ~/.sail/%s/ports.log", pid, pid)
// ss -l -p -n | grep pid=10749 > ~/.sail/10749/ports.log

fmt.Println(command)
if _, err := cmd.ExecuteAsScript(command, "ports log list failed"); err != nil {
return networks, err
// return networks, err
}

home := os.Getenv("HOME")
Expand Down

0 comments on commit 425e20f

Please sign in to comment.