From 425e20fcb45fdaeb708e916e9df037b93eba3abf Mon Sep 17 00:00:00 2001 From: logeshkrish Date: Thu, 14 Jan 2021 11:07:40 +0530 Subject: [PATCH] ports log error fixed --- .gitignore | 2 ++ cmd/folder.tar.gz | Bin 114 -> 114 bytes cmd/sail.go | 4 ++-- trace/dockerUtils/docker.go | 12 ++++++------ trace/startTrace/trace.go | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index abbf26a..24edf06 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ vendor/ sail Dockerfile *.log +cmd/sail +cmd/folder.* diff --git a/cmd/folder.tar.gz b/cmd/folder.tar.gz index 395a6afa346d8fad570e47d53270f6b8ba957133..89fde1666daa86d78e027a8760cca056fe54d078 100644 GIT binary patch delta 12 TcmXRaVw3OYV7U5xB3ljs8XW{& delta 12 TcmXRaVw3OYU|_j8ku3)R6|e(! diff --git a/cmd/sail.go b/cmd/sail.go index 2817349..68847b8 100644 --- a/cmd/sail.go +++ b/cmd/sail.go @@ -113,7 +113,7 @@ 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") @@ -121,7 +121,7 @@ func main() { 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...") diff --git a/trace/dockerUtils/docker.go b/trace/dockerUtils/docker.go index 517baba..4b6dad6 100644 --- a/trace/dockerUtils/docker.go +++ b/trace/dockerUtils/docker.go @@ -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 } @@ -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 @@ -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 } diff --git a/trace/startTrace/trace.go b/trace/startTrace/trace.go index ec7a956..36225c3 100644 --- a/trace/startTrace/trace.go +++ b/trace/startTrace/trace.go @@ -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")