From 80e8538037b0b1d760b09c6ff4e6b8871d4767fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Sat, 19 Aug 2023 08:17:52 +0200 Subject: [PATCH] fix: assign proper database name to superset user When running `do cairn-createuser`, the created db did not have the right name. If the user had been created earlier with SSO, then the Clickhouse DB did not exist. --- changelog.d/20230819_081659_regis.md | 1 + tutorcairn/templates/cairn/build/cairn-superset/cairn/ctl.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20230819_081659_regis.md diff --git a/changelog.d/20230819_081659_regis.md b/changelog.d/20230819_081659_regis.md new file mode 100644 index 0000000..492adad --- /dev/null +++ b/changelog.d/20230819_081659_regis.md @@ -0,0 +1 @@ +- [Bugfix] Fix superset database name in user creation with `do cairn-createuser`. (by @regisb) diff --git a/tutorcairn/templates/cairn/build/cairn-superset/cairn/ctl.py b/tutorcairn/templates/cairn/build/cairn-superset/cairn/ctl.py index 679a2c7..ce8bd0b 100644 --- a/tutorcairn/templates/cairn/build/cairn-superset/cairn/ctl.py +++ b/tutorcairn/templates/cairn/build/cairn-superset/cairn/ctl.py @@ -77,7 +77,7 @@ def main(): "--database", help=( "Name of the Superset database to which the objects should be linked." - " By default, this will be the same as the username." + " By default, this will be the 'openedx-'." ), ) parser_dashboards.add_argument("username") @@ -92,7 +92,7 @@ def main(): # but the "create-user" command fails if the user already exists. def bootstrap_user(args): # Bootstrap database - database_name = args.db or args.username + database_name = args.db or f"openedx-{args.username}" cairn_bootstrap.create_superset_db(args.username, database_name) # Get or create user