Skip to content

[Profile] Hotfix: Fix #15961: az login: UnboundLocalError: local variable 'token_entry' referenced before assignment#15962

Merged
jiasli merged 2 commits intoAzure:releasefrom
evelyn-ys:refine_invalid_url
Nov 20, 2020
Merged

[Profile] Hotfix: Fix #15961: az login: UnboundLocalError: local variable 'token_entry' referenced before assignment#15962
jiasli merged 2 commits intoAzure:releasefrom
evelyn-ys:refine_invalid_url

Conversation

@evelyn-ys
Copy link
Member

@evelyn-ys evelyn-ys commented Nov 18, 2020

Description

Fix #15961 : az login: UnboundLocalError: local variable 'token_entry' referenced before assignment
In previous pr #15776 , Invalid Url is captured and handled, but other exceptions are hidden inappropriately.
This pr revokes previous change, InvalidUrl handling need further discussion.

Testing Guide

Copy link
Member Author

Choose a reason for hiding this comment

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

There should be raise ex here

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 18, 2020

Profile

@yonzhan yonzhan added this to the S179 milestone Nov 18, 2020
Copy link
Member

Choose a reason for hiding this comment

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

A white space usually goes to the previous line.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

Comment on lines 133 to 134
Copy link
Member

Choose a reason for hiding this comment

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

A browse won't be available on CI machine, so auth code flow won't be used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Appreciate for your help! That makes sense why CI fails....

@evelyn-ys evelyn-ys requested review from jiasli and qwordy November 19, 2020 10:29
Copy link
Member

Choose a reason for hiding this comment

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

adal.AuthenticationContext will not be called, since SubscriptionFinder is using lambda _, _1, _2: mock_auth_context.

mock_auth_context can simply be created as a MagicMock().

Copy link
Member

Choose a reason for hiding this comment

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

Please make this a more general test case so that other errors can also be tested to avoid regression.

Copy link
Member

Choose a reason for hiding this comment

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

Please print the error detail.

@jiasli jiasli changed the title {Profile} refine InvalidUrl when login [Profile] Fix #15961: az login: UnboundLocalError: local variable 'token_entry' referenced before assignment Nov 20, 2020
@jiasli jiasli changed the base branch from dev to release November 20, 2020 02:01
@jiasli jiasli changed the title [Profile] Fix #15961: az login: UnboundLocalError: local variable 'token_entry' referenced before assignment [Profile] Hotfix: Fix #15961: az login: UnboundLocalError: local variable 'token_entry' referenced before assignment Nov 20, 2020
@qwordy
Copy link
Member

qwordy commented Nov 20, 2020

Hard to review. The changes are mixed up with unrelated changes.

@jiasli jiasli force-pushed the refine_invalid_url branch from 49eeb83 to 2a1052a Compare November 20, 2020 02:51
@jiasli
Copy link
Member

jiasli commented Nov 20, 2020

Hard to review. The changes are mixed up with unrelated changes.

I have fixed the history.

@jiasli jiasli requested review from houk-ms and removed request for kairu-ms and msyyc November 20, 2020 03:33
Copy link
Contributor

@houk-ms houk-ms left a comment

Choose a reason for hiding this comment

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

Could we explain more details about what's happening there in the pr description?

@jiasli
Copy link
Member

jiasli commented Nov 20, 2020

Could we explain more details about what's happening there in the pr description?

Will do a full analysis next week.

@jiasli jiasli merged commit db2711a into Azure:release Nov 20, 2020
@jiasli jiasli mentioned this pull request Sep 17, 2021
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.

az login fails with UnboundLocalError: local variable 'token_entry' referenced before assignment

7 participants

Comments