Nonexit Tethys Create DB CLI Command #1087
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This merge request addresses an issue with the tethys db create CLI command. The issue occurs when multiple portals are trying to share a single database with the same tethys_super table. If the tethys_super table already exists, then the tethys db create CLI command will try to create the tethys_super table, fail to do so, and then exit before the table for the portal is created.
This merge request sets the exit_on_error to False for the create_db_user call inside of the create_tethys_db function. This will ensure that both create_db_user calls are executed, whether they are successful or not. To keep the same behavior currently where the create_tethys_db function can exit on an error, I have added a exit_creation_on_error argument to the function. If set to True, then the function will exit if either one of the create_db_user calls fails.
I also updated the logging in the create_tethys_db function to give more details on what user or database is being created
Steps to reproduce
Quality Checks