aai-institute/lakefs-spec

Move YAML file existence check into `LakectlConfig`

Closed this issue · 0 comments

          > > (also looking at the same method, the error message for missing `PyYAML` is slightly inaccurate: it says that the config file exists, even when it might not)

Hm, good point. We do in fact only call LakectlConfig.read() if the path input exists (see the file system constructor), but to make this portable, the existence check could probably be carried out again in the method?

But this raises the question of how to proceed if path.exists() is False. Return an empty object and risk silent errors, or raise?

For now, we can get away by (a) rewording the error message, and/or (b) reading the file first and then importing PyYAML (this would eliminate a race condition between the existence check and trying to read the file, while still keeping the error message relevant).

I wouldn't silently swallow the error and try to be too smart as it might lead to unexpected behavior.

Also happy to move this into a separate issue.

Originally posted by @AdrianoKF in #123 (comment)