From da9194a8784edb6287b8f11f19369134545bb5be Mon Sep 17 00:00:00 2001 From: Joel Rieke Date: Thu, 14 Mar 2024 15:55:16 -0700 Subject: [PATCH 1/2] Add some logging on memfile generation. --- pkg/cli/trcconfigbase/utils/configinator.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/cli/trcconfigbase/utils/configinator.go b/pkg/cli/trcconfigbase/utils/configinator.go index 62ec813e8..8053c1667 100644 --- a/pkg/cli/trcconfigbase/utils/configinator.go +++ b/pkg/cli/trcconfigbase/utils/configinator.go @@ -460,8 +460,10 @@ func writeToFile(config *eUtils.DriverConfig, data string, path string) { memFile.Write(byteData) memFile.Close() memCacheLock.Unlock() + eUtils.LogInfo(config, "Wrote memfile:"+path) } else { memCacheLock.Unlock() + eUtils.LogInfo(config, "Unexpected memfile exists:"+path) eUtils.CheckError(config, err, true) } } else { From 1c49764e3f33fa3a077c1f040f5fdbe3f1a06dd4 Mon Sep 17 00:00:00 2001 From: Joel Rieke Date: Thu, 14 Mar 2024 15:56:08 -0700 Subject: [PATCH 2/2] Adding path fallback. --- atrium/vestibulum/trcshbase/trcsh.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/atrium/vestibulum/trcshbase/trcsh.go b/atrium/vestibulum/trcshbase/trcsh.go index eca212518..0c1c3fcea 100644 --- a/atrium/vestibulum/trcshbase/trcsh.go +++ b/atrium/vestibulum/trcshbase/trcsh.go @@ -853,7 +853,21 @@ func ProcessDeploy(featherCtx *cap.FeatherContext, config *eUtils.DriverConfig, io.Copy(buf, memFile) // Error handling elided for brevity. content = buf.Bytes() } else { - fmt.Println("Error could not find " + trcPath + " for deployment instructions") + if strings.HasPrefix(trcPath, "./") { + trcPath = strings.TrimLeft(trcPath, "./") + } + if memFile, memFileErr = config.MemFs.Open(trcPath); memFileErr == nil { + // Read the generated .trc code... + buf := bytes.NewBuffer(nil) + io.Copy(buf, memFile) // Error handling elided for brevity. + content = buf.Bytes() + } else { + if strings.HasPrefix(trcPath, "./") { + trcPath = strings.TrimLeft(trcPath, "./") + } + + fmt.Println("Trcsh - Error could not find " + trcPath + " for deployment instructions") + } } if !isAgentToken { @@ -870,13 +884,13 @@ func ProcessDeploy(featherCtx *cap.FeatherContext, config *eUtils.DriverConfig, if config.EnvRaw == "itdev" { content, err = os.ReadFile(pwd + "/deploy/buildtest.trc") if err != nil { - fmt.Println("Error could not find /deploy/buildtest.trc for deployment instructions") + fmt.Println("Trcsh - Error could not find /deploy/buildtest.trc for deployment instructions") } } else { content, err = os.ReadFile(pwd + "/deploy/deploy.trc") if err != nil { - fmt.Println("Error could not find " + pwd + "/deploy/deploy.trc for deployment instructions") - config.Log.Printf("Error could not find %s/deploy/deploy.trc for deployment instructions", pwd) + fmt.Println("Trcsh - Error could not find " + pwd + "/deploy/deploy.trc for deployment instructions") + config.Log.Printf("Trcsh - Error could not find %s/deploy/deploy.trc for deployment instructions", pwd) } } }