Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonexit Tethys Create DB CLI Command #1087

Merged
merged 7 commits into from
Sep 3, 2024
Merged

Nonexit Tethys Create DB CLI Command #1087

merged 7 commits into from
Sep 3, 2024

Conversation

ckrew
Copy link
Contributor

@ckrew ckrew commented Aug 28, 2024

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

  • Setup the tethys_super DB table (without having the tethys default/portal table setup)
  • Run tethys db create
  • You will receive an error that the tethys_super table already exists and the tethys default table will not be created

Quality Checks

  • New code is 100% tested
  • Code has been formated
  • Code has been linted
  • Docstrings for new methods have been added

ckrew added 3 commits August 28, 2024 14:32
… create command

added more detail to logging for the tethys db create command
updated tests accordingly
this allows the configure_tethys_db function to continue to work with the _prompt_if_error function
updated tests
@ckrew ckrew requested review from swainn and sdc50 August 28, 2024 21:21
@coveralls
Copy link

coveralls commented Aug 28, 2024

Coverage Status

coverage: 99.936%. remained the same
when pulling 41aa26e on cli_db_create_nonfail
into fbf295d on main.

ckrew and others added 2 commits August 30, 2024 14:34
@ckrew
Copy link
Contributor Author

ckrew commented Aug 30, 2024

Removing the "SUPERUSER" role as part of this PR to cover #1069

@ckrew
Copy link
Contributor Author

ckrew commented Aug 30, 2024

Removing the "SUPERUSER" role as part of this PR to cover #1069

This actually caused the tests to fail so I added it back in so we could get this merged.

@swainn swainn merged commit c006cf1 into main Sep 3, 2024
42 checks passed
@swainn swainn deleted the cli_db_create_nonfail branch September 3, 2024 15:40
@sdc50 sdc50 added the bugfix label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants