Skip to content

Attempts account removal from broker first - #651

Merged
Ray Luo (rayluo) merged 1 commit into
devfrom
remove-broker-accounts-first
Jan 19, 2024
Merged

Attempts account removal from broker first#651
Ray Luo (rayluo) merged 1 commit into
devfrom
remove-broker-accounts-first

Conversation

@rayluo

Copy link
Copy Markdown
Contributor

This change is inspired by this conversation.

CC: Jiashuo Li (@jiasli)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what if broker sign out also throws an unexpected exception? Is this possible. I don't understand why self.forget_me would throw an error skipping execution below.

@rayluo

Copy link
Copy Markdown
Contributor Author

what if broker sign out also throws an unexpected exception? Is this possible.

It is always possible for any code path to potentially throw an exception. And we can let those really unexpected exceptions bubble up.

I don't understand why self.forget_me would throw an error skipping execution below.

In that referenced Azure CLI's case, they persist the MSAL Python's token cache on disk, and the forget_me() operation would attempt removing some tokens thus modifying that token cache file. Again, any code path could throw exception, in this case, it can be disk I/O error.

@jiasli

Copy link
Copy Markdown
Contributor

Thanks for the attempt to solve Azure/azure-cli#20231 (comment).

However, I don't think this change makes any difference as OSError: [WinError -2146893813] is thrown when get_accounts() is called. We won't even be able to retrieve the account that can be passed to remove_account(), because the account information is also in msal_token_cache.bin.

In other word, if msal_token_cache.bin can't be accessed, we totally lose track of what accounts are in WAM.

@jiasli Jiashuo Li (jiasli) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's rethink about it.

@rayluo
Ray Luo (rayluo) force-pushed the remove-broker-accounts-first branch from 495340f to 4a7d36a Compare January 19, 2024 20:47
@rayluo
Ray Luo (rayluo) merged commit 49a9198 into dev Jan 19, 2024
@rayluo
Ray Luo (rayluo) deleted the remove-broker-accounts-first branch January 19, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants