Skip to content

user auth: check for None, replace with [] #700

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/warnet/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def auth(auth_config):
if not is_first_config:
for category in ["clusters", "users", "contexts"]:
if category in auth_config:
if not base_config[category]:
Copy link
Contributor

@macgyver13 macgyver13 Mar 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will generate a KeyError exception if category is not in base_config right?

if category in base_config and not base_config[category] should work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! That works smoothly. Thank you.

base_config[category] = []
merge_entries(category, base_config, auth_config)

new_current_context = auth_config.get("current-context")
Expand Down
Loading