nccgroup / opinel

Python code shared by Scout2 and AWS-Recipes
GNU General Public License v2.0
24 stars 18 forks source link

use stderr instead of stdout for prompts #5

Closed philsnow closed 9 years ago

philsnow commented 9 years ago

I have a script that checks whether ~/.aws/credentials is older than some number of seconds, and re-runs the init-sts-session script if so before doing exec "$@" as the very last thing.

The point is to be able to run that_script s3cmd ls or that_script aws s3 ls or whatever other command, and have that_script notice that your temporary credential is probably expired by now and prompt you for a new MFA before trying the command.

Because AWSUtils prints to stdout, e.g. that_script s3cmd ls | sort gets the MFA prompt mixed in with the s3cmd output. Use stderr instead so that doesn't happen.

l01cd3v commented 9 years ago

For consistency, all prints should be modified to sys.stderr.write() calls in these two modified methods.

l01cd3v commented 9 years ago

Done in db96bc33be8811c9fddb3f923a042cfc658959a5

l01cd3v commented 9 years ago

Thanks. I might consider adding support for "autodetect expired session tokens" eventually