-
Notifications
You must be signed in to change notification settings - Fork 4k
Populate context list when no previous context found #6137
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
Conversation
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.
A couple of small changes. Also, can we write a unit test for this
string tempName = null; | ||
if (!_profile.TryGetContextName(tempContext, out tempName)) | ||
{ | ||
WriteWarningMessage(string.Format("Unable to get context name for subscription with id '{0}'.", subscription.Id)); |
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.
Let's put these strings into the assembly resources
|
||
if (!_profile.TrySetContext(tempName, tempContext)) | ||
{ | ||
WriteWarningMessage(string.Format("Cannot create a context for subscription with id '{0}'.", subscription.Id)); |
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.
same
@@ -260,6 +261,35 @@ public bool TryRemoveContext(IAzureContext context) | |||
} | |||
|
|||
_profile.DefaultContext.TokenCache = _cache; | |||
if (shouldPopulateContextList) |
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.
Were we going to add an option in to the login cmdlet that would disable populating the contexts? Also, I think we should set a default limit to the number of populated contexts (say, 25).
@cormacpayne You have merge conflicts that need to be resolved. |
Description
Fix for #6115
Checklist
CONTRIBUTING.md
platyPS
module