Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please make the shell scripts free of shellcheck errors #13

Open
rbalint opened this issue Feb 5, 2020 · 0 comments
Open

Please make the shell scripts free of shellcheck errors #13

rbalint opened this issue Feb 5, 2020 · 0 comments

Comments

@rbalint
Copy link

rbalint commented Feb 5, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant