Fix issue with -e flag not generating file correctly
This commit is contained in:
parent
4829fe8f54
commit
9491a890ab
1 changed files with 9 additions and 9 deletions
|
|
@ -7,6 +7,15 @@ def generate(args):
|
|||
aws_creds_file = 'credentials'
|
||||
aws_creds_full = aws_creds_dir + '/' + aws_creds_file
|
||||
|
||||
if os.path.isfile(os.path.expanduser(aws_creds_full)):
|
||||
answer = input(f"[WARNING] File {aws_creds_full} already exists. Atmos will generate a new credentials file from your env vars. \nDo you want to override {aws_creds_full}? [y/N]")
|
||||
if not answer or answer[0].lower() != 'y':
|
||||
print("File not changed. This flag is for CI/CD only")
|
||||
exit(1)
|
||||
else:
|
||||
if not os.path.isdir(os.path.expanduser(aws_creds_dir)):
|
||||
os.makedirs(os.path.expanduser(aws_creds_dir))
|
||||
|
||||
if current_workspace != 'default':
|
||||
workspaces_names.append(current_workspace)
|
||||
|
||||
|
|
@ -40,14 +49,5 @@ def generate(args):
|
|||
print("[ERROR]: Env Variable " + secret_key_name + " not found.")
|
||||
sys.exit(1)
|
||||
|
||||
if os.path.isfile(os.path.expanduser(aws_creds_full)):
|
||||
answer = input(f"[WARNING] File {aws_creds_full} already exists. Atmos will generate a new credentials file from your env vars. \nDo you want to override {aws_creds_full}? [y/N]")
|
||||
if not answer or answer[0].lower() != 'y':
|
||||
print("File not changed. This flag is for CI/CD only")
|
||||
exit(1)
|
||||
else:
|
||||
if not os.path.isdir(os.path.expanduser(aws_creds_dir)):
|
||||
os.makedirs(os.path.expanduser(aws_creds_dir))
|
||||
|
||||
with open(os.path.expanduser(aws_creds_full), 'w+') as f:
|
||||
f.write(contents)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue