-
Notifications
You must be signed in to change notification settings - Fork 3k
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
login: set default subscription to one with the state of "Enabled" #2575
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2575 +/- ##
==========================================
+ Coverage 72.32% 72.32% +<.01%
==========================================
Files 363 363
Lines 19835 19838 +3
Branches 2923 2924 +1
==========================================
+ Hits 14345 14348 +3
Misses 4582 4582
Partials 908 908
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one question.
def _pick_working_subscription(subscriptions): | ||
from azure.mgmt.resource.subscriptions.models import SubscriptionState | ||
s = next((x for x in subscriptions if x['state'] == SubscriptionState.enabled.value), None) | ||
return s or subscriptions[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the subscriptions
list is empty? Is that a scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caller of _set_subscriptions
will ensure the subscriptions will not be empty, so we are fine. Thanks for asking.
fix #2568