Skip to content

Commit

Permalink
Make a copy of the original profile_list to not modify it by mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgianaElena committed Aug 29, 2023
1 parent 8d0d3d1 commit b62a46a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions helm-charts/basehub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ jupyterhub:
)
c.Spawner.pre_spawn_hook = ensure_db_pvc
05-gh-teams: |
import copy
from textwrap import dedent
from tornado import gen, web
from oauthenticator.github import GitHubOAuthenticator
Expand Down Expand Up @@ -745,8 +747,10 @@ jupyterhub:
print(f"User {spawner.user.name} is part of teams {' '.join(teams)}")
allowed_profiles = []
for profile in original_profile_list:
# Make a copy of the original profile_list dict,
# otherwise we might end up modifying it by mistake
profile_list_copy = copy.deepcopy(original_profile_list)
for profile in profile_list_copy:
# If there is no ':' in allowed_teams, it's an org and we should check that
# differently
allowed_orgs = set([o for o in profile.get('allowed_teams', []) if ':' not in o])
Expand Down

0 comments on commit b62a46a

Please sign in to comment.