aws / aws/aws-ec2-instance-connect-config
Please make the shell scripts free of shellcheck errors
- Dominant language
- Shell
- Stars
- 88
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
Running shellcheck on latest master:
```
$ shellcheck src/bin/eic_*
In src/bin/eic_curl_authorized_keys line 90:
keys_status="$(/usr/bin/curl -s -f -m 1 -H "${IMDS_TOKEN_HEADER}" -o /dev/null -I -w %{http_code} "${IMDS}/managed-ssh-keys/active-keys/${1}/")"
^-- SC1083: This { is literal. Check expression (missing ;/\n?) or quote it.
^-- SC1083: This } is literal. Check expression (missing ;/\n?) or quote it.
In src/bin/eic_harvest_hostkeys line 54:
/bin/echo -n "${1}" | /usr/bin/sha256sum | /bin/sed 's/\s.*$//'
^-- SC2039: In POSIX sh, echo flags are undefined.
In src/bin/eic_harvest_hostkeys line 66:
base="$(/bin/echo -n "AWS4${1}" | /usr/bin/od -A n -t x1 | /bin/sed ':a;N;$!ba;s/[\n ]//g')"
^-- SC2039: In POSIX sh, echo flags are undefined.
In src/bin/eic_harvest_hostkeys line 74:
creds_status="$(/usr/bin/curl -s -f -m 1 -H "X-aws-ec2-metadata-token: ${IMDS_TOKEN}" -o /dev/null -I -w %{http_code} "http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance/")"
^-- SC1083: This { is literal. Check expression (missing ;/\n?) or quote it.
^-- SC1083: This } is literal. Check expression (missing ;/\n?) or quote it.
In src/bin/eic_harvest_hostkeys line 151:
payloadHash=$(/bin/echo -n "${val}" | /usr/bin/sha256sum | /bin/sed 's/\s.*$//')
^-- SC2039: In POSIX sh, echo flags are undefined.
In src/bin/eic_harvest_hostkeys line 154:
requestHash=$(/bin/echo -n "${canonicalRequest}" | /usr/bin/sha256sum | /bin/sed 's/\s.*$//')
^-- SC2039: In POSIX sh, echo flags are undefined.
For more information:
https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
https://www.shellcheck.net/wiki/SC2039 -- In POSIX sh, echo flags are undef...
```
I recognize that those are minor issues, but making the scripts passing shellcheck can help in automated QA.
Contributor guide
Research direction
Start with src/bin/eic_curl_authorized_keys and src/bin/eic_harvest_hostkeys, reviewing the lines reported by the shellcheck output in the issue. Run shellcheck src/bin/eic_* before and after the changes; done means the listed SC1083 and SC2039 errors, and any resulting shellcheck errors, are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- devops
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100