Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

include check for aws executable in import_users #111

Closed
packetfairy opened this issue Jan 17, 2018 · 2 comments
Closed

include check for aws executable in import_users #111

packetfairy opened this issue Jan 17, 2018 · 2 comments

Comments

@packetfairy
Copy link

Operating System: Linux
AWS CLI Version: aws-cli/1.11.13 Python/3.5.2 Linux/4.13.0-1006-gcp botocore/1.4.70

--

import_users.sh should include a check for aws executable, and exit if it fails to find it.

We replaced the apt supplied aws cli tool for a pip supplied tool today. The pip supplied tool was dropped into /usr/local/bin, which was not part of root's default PATH. When import_users.sh ran, it found no aws command, so iam_users was empty, which resulted in the removal of all local users. This was a difficult afternoon. :)

I've used this at the top of the file:

AWS=$(which aws)
if [ -z "${AWS}" ]; then
echo "aws executable not found - exiting!"
exit 1
fi

@michaelwittig
Copy link
Contributor

Hi @packetfairy thanks for reporting this and sorry for the troubles this has caused to you.

would:

if ! which aws; then
echo "aws executable not found - exiting!"
exit 1
fi

also do the trick?

@packetfairy
Copy link
Author

Yeah, that's much cleaner, thanks. :)

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

No branches or pull requests

2 participants