Add check for -e flag for overriding aws creds file

This commit is contained in:
Conor 2020-01-24 15:20:29 +01:00
parent b7f72bb67b
commit b11f87e709

View file

@ -37,4 +37,10 @@ def generate(args):
print("[ERROR]: Env Variable " + secret_key_name + " not found.")
sys.exit(1)
with open(os.path.expanduser('~/.aws/credentials'), 'w+') as f:
f.write(contents)
if os.path.isfile(f.name):
answer = input("Found aws creds file already, do you want to override? [y/n]")
if not answer or answer[0].lower() != 'y':
print("File not changed. This flag is for CI/CD only")
exit(1)
else:
f.write(contents)