From f2d617bbcee2ed01a7b9eefa0713ed3c5f7ef5a7 Mon Sep 17 00:00:00 2001 From: tanshu Date: Thu, 16 Sep 2021 12:21:42 +0530 Subject: [PATCH] Fix: Add / Update user error when a role was added. --- brewman/brewman/routers/user.py | 2 +- deploy.sh | 2 ++ version_bump.sh | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/brewman/brewman/routers/user.py b/brewman/brewman/routers/user.py index 98f0f5f8..5d1d05f2 100644 --- a/brewman/brewman/routers/user.py +++ b/brewman/brewman/routers/user.py @@ -102,7 +102,7 @@ def add_roles(user: User, roles: List[schemas.RoleItem], db: Session) -> None: ug = [g for g in user.roles if g.id == role.id_] ug = None if len(ug) == 0 else ug[0] if role.enabled and ug is None: - user.roles.append(db.execute(select(Role).where(Role.id == role.id_)).one()) + user.roles.append(db.execute(select(Role).where(Role.id == role.id_)).scalar_one()) elif not role.enabled and ug: user.roles.remove(ug) diff --git a/deploy.sh b/deploy.sh index 07d12cb9..1a6f0119 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +set -e + parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P ) cd "$parent_path" || exit diff --git a/version_bump.sh b/version_bump.sh index 6202d1c9..4d1c13f4 100755 --- a/version_bump.sh +++ b/version_bump.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +set -e + parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P ) cd "$parent_path" || exit