AWS SSM adds \t and removes ' ocassionally

0

very weird thing happening in AWS SSM Parameter Input. The pasted input below gets modified in AWS SSM Automation Documents. Can anyone tell me why this happens? It breaks my script and i can't work with this.

here's my code

schemaVersion: "2.2"
description: "Check HANA DB and stop it LINUX"
mainSteps:
- action: "aws:runShellScript"
  name: "HANA_DB_STOP"
  inputs:
    runCommand:
        - '#### errocodes'
        - '#### 0   =   SCRIPT RAN OK'
        - '#### 10  =   SCRIPT FAILED'
        - ''
        - '# stop hana db'
        - 'echo "Stopping Hana DB"'
        - 'sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function Stop'
        - ''
        - '# check hana db state'
        - 'echo "Checking if Hana DB is running."'
        - 'HANADBSTATUS=`sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList`'
        - 'sleep 20'
        - 'if [[ "$HANADBSTATUS" =~ "GRAY" ]]'
        - 'then'
        - '    echo "Hana DB is stopped."'
        - '    exit 0'
        - 'else'
        - 'i=1'
        - 'while [[ ! "$HANADBSTATUS" =~ "GRAY" ]] && [[ "$i" -lt 11 ]]'
        - ' do'
        - '     echo "Warning: HANA DB is running. Checking 10 times with 20 second intervalls until script aborts. This is check $i." '
        - '     sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function Stop'
        - '     sleep 20'
        - '     # check db state again'
        - '     HANADBSTATUS=`sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList`'
        - '     ((i++))'
        - '     if [ "$i" = 10 ]'
        - '         then'
        - '             echo "Error: retried $i-Times. Couldnt stop DB. Exiting Script."'
        - '             echo "Script aborts with Error 0"'
        - '             exit 10'
        - '     fi'
        - ' done'
        - ' if [[ "$HANADBSTATUS" =~ "GRAY" ]]'
        - '    then'
        - '        echo "Hana DB is stopped."'
        - '        exit 0'
        - ' fi'
        - 'fi'

This is the output AWS gives me

schemaVersion: '2.2'
description: Check HANA DB and stop it LINUX
mainSteps:
  - action: 'aws:runShellScript'
    name: HANA_DB_STOP
    inputs:
      runCommand:
        - '#### errocodes'
        - "#### 0\t=   SCRIPT RAN OK"
        - "#### 10\t=   SCRIPT FAILED"
        - ''
        - '# stop hana db'
        - echo "Stopping Hana DB"
        - sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function Stop
        - ''
        - '# check hana db state'
        - echo "Checking if Hana DB is running."
        - HANADBSTATUS=`sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList`
        - sleep 20
        - 'if [[ "$HANADBSTATUS" =~ "GRAY" ]]'
        - then
        - '    echo "Hana DB is stopped."'
        - '    exit 0'
        - else
        - i=1
        - 'while [[ ! "$HANADBSTATUS" =~ "GRAY" ]] && [[ "$i" -lt 11 ]]'
        - "\tdo"
        - "\t\techo \"Warning: HANA DB is running. Checking 10 times with 20 second intervalls until script aborts. This is check $i.\" "
        - "\t\tsudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function Stop"
        - "\t\tsleep 20"
        - "\t\t# check db state again"
        - "\t\tHANADBSTATUS=`sudo /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList`"
        - "\t\t((i++))"
        - "\t\tif [ \"$i\" = 10 ]"
        - "\t\t\tthen"
        - "\t\t\t\techo \"Error: retried $i-Times. Couldnt stop DB. Exiting Script.\""
        - "\t\t\t\techo \"Script aborts with Error 0\""
        - "\t\t\t\texit 10"
        - "\t\tfi"
        - "\tdone"
        - "\tif [[ \"$HANADBSTATUS\" =~ \"GRAY\" ]]"
        - '    then'
        - '        echo "Hana DB is stopped."'
        - '        exit 0'
        - "\tfi"
        - fi

I know why \t gets added, but i still don't understand why and how it removes the ' in my scripts

1개 답변
0

Hello,

I am an AWS technical support engineer. I did raise this query with our engineering team and we would need more details to debug further.

As our customer's data privacy is paramount to us. We are unable to ask your confidential data on repost. I would request you to create a Support Case with us to assist further.

[+] Creating support cases and case management - https://docs.aws.amazon.com/awssupport/latest/user/case-management.html

AWS
지원 엔지니어
Sunil
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠