From 25632dd34e515240e837acb34c627cffca6bb321 Mon Sep 17 00:00:00 2001 From: ZeljkoBenovic Date: Sat, 18 Nov 2023 14:33:25 +0100 Subject: [PATCH] fix bash script support --- aws/ssm/ssm.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aws/ssm/ssm.go b/aws/ssm/ssm.go index 40696cd..86c024d 100644 --- a/aws/ssm/ssm.go +++ b/aws/ssm/ssm.go @@ -127,7 +127,12 @@ func (s ssm) readBashFileAndProvideCommands() ([]*string, error) { return nil, err } + s.log.Debug("Script content read", "content", string(fileBytes)) + for _, cmdLine := range strings.Split(string(fileBytes), "\n") { + cmdLine := cmdLine // closure capture + s.log.Debug("Script line read", "line", cmdLine) + cmds = append(cmds, &cmdLine) } @@ -158,7 +163,11 @@ func displayResults(instanceId *string, data *assm.GetCommandInvocationOutput) { buff.WriteString(*data.StandardErrorContent) } - buff.WriteString("====================\n\n") + if *data.StandardOutputContent == "" && *data.StandardErrorContent == "" { + buff.WriteString("NO CONTENT TO SHOW\n") + } + + buff.WriteString("====================\n") fmt.Print(buff.String()) }