Add option to set the settings.yaml path
According to documentation currently the settings.yaml file should be filled and placed at ~/cloudwash/settings.yaml. I was expecting that would be the path where cloudwash looks for the file. Instead it is looking for the file at current path where the tool is been executed.
Using the image on a different context like Tekton the execution will end on error:
<<<<<<< Running the cleanup script in DRY RUN mode >>>>>>>
Traceback (most recent call last):
File "/opt/app-root/bin/swach", line 8, in <module>
sys.exit(cleanup_providers())
File "/opt/app-root/lib64/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/opt/app-root/lib64/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/opt/app-root/lib64/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/app-root/lib64/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/app-root/lib64/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/opt/app-root/lib64/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/opt/app-root/lib64/python3.8/site-packages/cloudwash/cli.py", line 87, in ec2
validate_provider([ctx.command.name](http://ctx.command.name/))
File "/opt/app-root/lib64/python3.8/site-packages/cloudwash/config.py", line 13, in validate_provider
f"{provider}.{setting_key}" for setting_key in settings.to_dict()["PROVIDERS"].get(provider)
This is because the working dir (from where swach will be executed) for the tekton task is /tekton/home and the file is at /tekton/home/cloudwash/settings.yaml
So it would be great if a new option for passing the settings file path would be added:
swach --settings-file /custom_path/settings.yaml
Would be great to have .config/cloudwatch/ in the search path as well, it is where most of us expect config files these days :)
Hi @adrianriobo Can I work on this issue?
Yeah I guess you can ask @jyejare , I just reported it but can not work on it...I think it would be great if you add this feature
Hey @bovem you are more than welcome for contribution :)
Thanks, I'll raise a PR.
@bovem Where are you upto on this? Are you still interested ?
@jyejare Yes, I am working on it. I will create a WIP PR for progress tracking.
I have added the flag but I think I have to make changes to individual provider's cleanup code to add settings path param.
@bovem I would love to see what great stuffs your PR brings up :)