Kenza-AI / sagify

LLMs and Machine Learning done easily
https://kenza-ai.github.io/sagify/
MIT License
434 stars 69 forks source link

AWS profile choice default throws IndexError #128

Closed nsorros closed 3 years ago

nsorros commented 3 years ago

Running sagify init and selecting the default aws profile by clicking enter instead of typing 1 throws an IndexError

Select AWS profile:
1 - default
Choose from 1 [1]:
Traceback (most recent call last):
  File "/data/code/sagemaker/sagify-demo/venv/bin/sagify", line 8, in <module>
    sys.exit(cli())
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/sagify/commands/initialize.py", line 129, in init
    aws_profile, aws_region = ask_for_aws_details()
  File "/data/code/sagemaker/sagify-demo/venv/lib/python3.6/site-packages/sagify/commands/initialize.py", line 97, in ask_for_aws_details
    chosen_profile = available_profiles[chosen_profile_index]
IndexError: list index out of range

This is probably because the validation, which reduces the index does not run in the case so the default choise of 1 remains and in the case of 1 profile that throws an error. In the case of multiple profiles, the wrong profile is selected.

pm3310 commented 3 years ago

Hey @nsorros thank you for catching it.

pm3310 commented 3 years ago

@nsorros Just released 0.20.9 with your fix :-)