Skip to content

Commit cfc6a96

Browse files
committed
Fix lock retry interval, help message typos in profile cmdlets
1 parent 5e57026 commit cfc6a96

18 files changed

+30
-26
lines changed

src/ResourceManager/Common/Commands.Common.Authentication.ResourceManager/ProtectedFileProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public enum FileProtection
3333
/// </summary>
3434
public abstract class ProtectedFileProvider : IFileProvider, IDisposable
3535
{
36-
const int MaxTries = 3;
37-
static readonly TimeSpan RetryInterval = TimeSpan.FromSeconds(5);
36+
public const int MaxTries = 30;
37+
static readonly TimeSpan RetryInterval = TimeSpan.FromMilliseconds(500);
3838
protected Stream _stream;
3939
object _initializationLock = new object();
4040
public string FilePath { get; set; }
@@ -117,7 +117,7 @@ static bool TryGetStreamLock(Func<string, Stream> acquireLock, string filePath,
117117
catch (IOException)
118118
{
119119
tries++;
120-
// TestMockSupport.Delay(RetryInterval);
120+
TestMockSupport.Delay(RetryInterval);
121121
}
122122
}
123123
while (tries <= MaxTries && stream == null);

src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public AzureRMCmdlet()
4545
/// <summary>
4646
/// Gets or sets the global profile for ARM cmdlets.
4747
/// </summary>
48-
[Parameter(Mandatory =false, HelpMessage="The credeetnails, tenant and subscription used for communication with azure")]
48+
[Parameter(Mandatory =false, HelpMessage= "The credentials, account, tenant, and subscription used for communication with azure.")]
4949
[Alias("AzureRmContext", "AzureCredential")]
5050
public IAzureContextContainer DefaultProfile
5151
{

src/ResourceManager/Profile/AzureRM.Profile.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ CmdletsToExport = 'Disable-AzureRmDataCollection', 'Disable-AzureRmContextAutosa
8585
# VariablesToExport = @()
8686

8787
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
88-
AliasesToExport = 'Login-AzureRmAccount', 'Select-AzureRmSubscription', 'Resolve-Error', 'Logout-AzAccount', 'Logout-AzureRmAccount', 'Logout-AzAccount'
88+
AliasesToExport = 'Login-AzureRmAccount', 'Select-AzureRmSubscription', 'Resolve-Error', 'Logout-AzAccount', 'Logout-AzureRmAccount', 'Login-AzAccount'
8989

9090
# DSC resources to export from this module
9191
# DscResourcesToExport = @()

src/ResourceManager/Profile/Commands.Profile.Test/ProtectedFileProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ public void LockFailureThrowsGoodException()
107107
{
108108

109109
Assert.Contains(protectedFile, Assert.Throws<UnauthorizedAccessException>(() => ProtectedFileProvider.CreateFileProvider(protectedFile, FileProtection.SharedRead, store.Object).Stream).Message);
110-
store.Verify(d => d.OpenForSharedRead(It.IsAny<string>()), Times.Exactly(4));
110+
store.Verify(d => d.OpenForSharedRead(It.IsAny<string>()), Times.Exactly(ProtectedFileProvider.MaxTries + 1));
111111
Assert.Contains(protectedFile, Assert.Throws<UnauthorizedAccessException>(() => ProtectedFileProvider.CreateFileProvider(protectedFile, FileProtection.ExclusiveWrite, store.Object).Stream).Message);
112-
store.Verify(d => d.OpenForExclusiveWrite(It.IsAny<string>()), Times.Exactly(4));
112+
store.Verify(d => d.OpenForExclusiveWrite(It.IsAny<string>()), Times.Exactly(ProtectedFileProvider.MaxTries + 1));
113113
}
114114
finally
115115
{

src/ResourceManager/Profile/Commands.Profile/AzureRmProfileStartup.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@
1818
"Save-AzureRmProfile" = "Save-AzureRmContext";
1919
"Select-AzureRmProfile" = "Import-AzureRmContext";
2020
"Resolve-Error" = "Resolve-AzureRmError";
21+
"Logout-AzAccount" = "Remove-AzureRmAccount";
22+
"Logout-AzureRmAccount" = "Remove-AzureRmAccount";
23+
"Login-AzAccount" = "Add-AzureRmAccount";
2124
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias" | Out-Null
2225

src/ResourceManager/Profile/Commands.Profile/Common/AzureContextModificationCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Microsoft.Azure.Commands.Profile.Common
3131
/// </summary>
3232
public class AzureContextModificationCmdlet : AzureRMCmdlet
3333
{
34-
[Parameter(Mandatory = false, HelpMessage = "Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user")]
34+
[Parameter(Mandatory = false, HelpMessage = "Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.")]
3535
public ContextModificationScope Scope { get; set; }
3636

3737

src/ResourceManager/Profile/Commands.Profile/help/Add-AzureRmAccount.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Accept wildcard characters: False
215215
```
216216
217217
### -DefaultProfile
218-
The credeetnails, tenant and subscription used for communication with azure
218+
The credentials, account, tenant, and subscription used for communication with azure.
219219
220220
```yaml
221221
Type: IAzureContextContainer

src/ResourceManager/Profile/Commands.Profile/help/Add-AzureRmEnvironment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ Accept wildcard characters: False
369369
```
370370
371371
### -Scope
372-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
372+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
373373
374374
```yaml
375375
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/AzureRM.Profile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Gets the metadata used to authenticate Azure Resource Manager requests.
4040

4141
### [Get-AzureRmContextAutosaveSetting](Get-AzureRmContextAutosaveSetting.md)
4242
Display metadata about the context autosave feature, including whterh the context is
43-
automaticallys aved, and where saved context and credential information cna be found.
43+
automatically saved, and where saved context and credential information can be found.
4444

4545
### [Get-AzureRmEnvironment](Get-AzureRmEnvironment.md)
4646
Get endpoints and metadata for an instance of Azure services.

src/ResourceManager/Profile/Commands.Profile/help/Disable-AzureRmDataCollection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This example shows how to disable data collection for the current user.
4040
## PARAMETERS
4141

4242
### -DefaultProfile
43-
The credeetnails, tenant and subscription used for communication with azure.
43+
The credentials, account, tenant and subscription used for communication with azure.
4444

4545
```yaml
4646
Type: IAzureContextContainer

src/ResourceManager/Profile/Commands.Profile/help/Enable-AzureRmDataCollection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This example shows how to enable data collection for the current user.
4141
## PARAMETERS
4242

4343
### -DefaultProfile
44-
The credeetnails, tenant and subscription used for communication with azure.
44+
The credentials, account, tenant and subscription used for communication with azure.
4545

4646
```yaml
4747
Type: IAzureContextContainer

src/ResourceManager/Profile/Commands.Profile/help/Get-AzureRmContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ In this example, all currently available contexts are displayed. The user may s
7171
## PARAMETERS
7272

7373
### -DefaultProfile
74-
The credentials, tenant and subscription used for communication with azure
74+
The credentials, account, tenant and subscription used for communication with azure
7575

7676
```yaml
7777
Type: IAzureContextContainer

src/ResourceManager/Profile/Commands.Profile/help/Get-AzureRmContextAutosaveSetting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Get-AzureRmContextAutosaveSetting [-Scope <ContextModificationScope>]
1818
```
1919

2020
## DESCRIPTION
21-
Display metadata about the context autosave feature, including whterh the context is
22-
automaticallys aved, and where saved context and credential information cna be found.
21+
Display metadata about the context autosave feature, including whether the context is
22+
automatically saved, and where saved context and credential information can be found.
2323

2424
## EXAMPLES
2525

@@ -56,7 +56,7 @@ to the default location.
5656
## PARAMETERS
5757

5858
### -DefaultProfile
59-
The credentials, tenant and subscription used for communication with azure
59+
The credentials, account, tenant and subscription used for communication with azure
6060

6161
```yaml
6262
Type: IAzureContextContainer
@@ -71,7 +71,7 @@ Accept wildcard characters: False
7171
```
7272
7373
### -Scope
74-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
74+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
7575
7676
```yaml
7777
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Get-AzureRmEnvironment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ This example shows how to get the endpoints and metadata for the AzureUSGovernme
104104
## PARAMETERS
105105

106106
### -DefaultProfile
107-
The credeetnails, tenant and subscription used for communication with azure.
107+
The credentials, account, tenant and subscription used for communication with azure.
108108

109109
```yaml
110110
Type: IAzureContextContainer

src/ResourceManager/Profile/Commands.Profile/help/Import-AzureRmContext.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Accept wildcard characters: False
105105
```
106106
107107
### -Scope
108-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user.
108+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
109109
110110
```yaml
111111
Type: ContextModificationScope
@@ -156,11 +156,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
156156
## INPUTS
157157
158158
### Microsoft.Azure.Commands.Common.Authentication.Models.AzureRMProfile
159-
System.String
159+
Contains the set of credentials, accounts, and subscriptions that are used to communicate with Azure.
160160
161161
## OUTPUTS
162162
163163
### Microsoft.Azure.Commands.Profile.Models.PSAzureProfile
164+
Contains the set of credentials, accounts, and subscriptions that can be used to communicate with Azure.
164165
165166
## NOTES
166167

src/ResourceManager/Profile/Commands.Profile/help/Remove-AzureRmAccount.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Remove-AzureRmAccount [-AzureContext] <PSAzureContext> [-Scope <ContextModificat
4242
```
4343

4444
## DESCRIPTION
45-
Remove all credentials, and contexts (subscription and tenant information) associated witht he given account. After
45+
Remove all credentials, and contexts (subscription and tenant information) associated with the given account. After
4646
executing this cmdlet, you will need to login again using Add-AzureRmAccount
4747

4848
## EXAMPLES
@@ -59,7 +59,7 @@ Logs out the account associated with the current context.
5959
PS C:\> Get-AzureRmContext "Work" | Remove-AzureRmAccount -Scope CurrentUser
6060
```
6161

62-
Logs out the account associated with the given context (named 'Work'). Because this uses the 'CurrewntUser' scope, all credentials and
62+
Logs out the account associated with the given context (named 'Work'). Because this uses the 'CurrentUser' scope, all credentials and
6363
contexts will be permanently deleted.
6464

6565
### Log out a particular user
@@ -147,7 +147,7 @@ Accept wildcard characters: False
147147
```
148148
149149
### -Scope
150-
Determines the scope of context changes, for example, whether changes apply only to the cusrrent process, or to all sessions started by this user
150+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
151151
152152
```yaml
153153
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Remove-AzureRmEnvironment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Accept wildcard characters: False
108108
```
109109
110110
### -Scope
111-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user.
111+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
112112
113113
```yaml
114114
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Set-AzureRmEnvironment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Accept wildcard characters: False
233233
```
234234
235235
### -DefaultProfile
236-
The credeetnails, tenant and subscription used for communication with azure.
236+
The credentials, account, tenant and subscription used for communication with azure.
237237
238238
```yaml
239239
Type: IAzureContextContainer

0 commit comments

Comments
 (0)