Skip to content

Commit

Permalink
Copy cluster dicts from get_all_clusters() before modifying them.
Browse files Browse the repository at this point in the history
  • Loading branch information
notoraptor committed Nov 28, 2024
1 parent 2c8b23c commit 0e9eeaa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clockwork_web/core/users_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,12 @@ def render_template_with_user_settings(template_name_or_list, **context):
context["web_settings_json_str"] = json.dumps(context["web_settings"])

# Send the clusters infos to the template
context["clusters"] = get_all_clusters()
# NB: get_all_clusters() seems to return the clusters dict itself
# from config, not a copy. So, any modification on clusters dict
# returned by this function will be propagated into config.
# As we don't want this behaviour here, we will make a copy
# of each cluster dict.
context["clusters"] = {k: v.copy() for k, v in get_all_clusters().items()}
# List clusters available for connected user,
# or set an empty list for anon user.
context["user_clusters"] = (
Expand Down

0 comments on commit 0e9eeaa

Please sign in to comment.