enumerate-iam
enumerate-iam copied to clipboard
Added support for AWS Credentials profiles and enhanced Ctrl-C handling
This commit introduced support for --profile
argument for those who has multiple AWS credentials stored creds file with dedicated profile name labels. Also, since Pool.map
is a blocking operation, found Ctrl-C not working anytime I hit it. Therefore a minor work was done to switch parallel execution to map_async
approach, while introducing general timeout of 600 seconds and reinforcing SIGINT handler accoriding to the following recipe:
https://stackoverflow.com/questions/11312525/catch-ctrlc-sigint-and-exit-multiprocesses-gracefully-in-python
Best regards, M.
Also, since Pool.map is a blocking operation, found Ctrl-C not working anytime I hit it.
Maybe it is not working because the process is running one of the threads and there is a broad try/except clause like the one we see here:
https://github.com/andresriancho/enumerate-iam/blob/master/enumerate_iam/main.py#L144
Instead of implementing the map_async
/ SIGINT
approach please let's try to change the way Ctrl+C is handled inside threads. In other words, search for all broad try / except clauses and make them raise KeyboardInterrupt
.
The original code has KeyboardInterrupt handling and I remember testing it at some point. Does it work on some scenarios for you? Never?
getting this with the fork (I was looking for a solution to the CTRL-C issue):
Traceback (most recent call last):
File "enumerate-iam.py", line 60, in
got rid of import botocore.vendored.requests.packages.urllib3 as urllib3 and the following line in main.py.
Not sure if it will have side effects...