Skip to content

Commit f989810

Browse files
committed
Bug fixes: 1908985, 1907418, 1898689,1901426. Fixing TemplateImage RegEx
1 parent d9b6c1c commit f989810

9 files changed

+46
-9
lines changed

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Collection/UpdateAzureRemoteAppCollection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class UpdateAzureRemoteAppCollection : RdsCmdlet
3535
ValueFromPipelineByPropertyName = true,
3636
HelpMessage = "The name of the RemoteApp template image."
3737
)]
38-
[ValidatePattern(TemplateNameValidatorString)]
3938
public string ImageName { get; set; }
4039

4140
public override void ExecuteCmdlet()

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.Designer.cs

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,13 @@
240240
<data name="UseageNotFound" xml:space="preserve">
241241
<value>No usage found for the requested period.</value>
242242
</data>
243+
<data name="RequestFailed" xml:space="preserve">
244+
<value>The request failed.</value>
245+
</data>
246+
<data name="RequestSuccessful" xml:space="preserve">
247+
<value>The request completed successfully.</value>
248+
</data>
249+
<data name="VNetTimeout" xml:space="preserve">
250+
<value>The request took a long time to complete.</value>
251+
</data>
243252
</root>

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Common/RemoteAppRegEx.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public abstract partial class RdsCmdlet
3030

3131
protected const string UserPrincipalValdatorString = UserNameValidatorString + "@" + DomainNameValidatorString;
3232

33-
protected const string TemplateNameValidatorString = @"^[A-Za-z][._\-A-Za-z0-9]{1,61}[A-Z-a-z0-9]$";
33+
protected const string ListTemplateImageNameValidatorString = @"^[()A-Za-z][() ._\-A-Za-z0-9]{1,61}[A-Z-a-z0-9()]$";
34+
35+
protected const string TemplateImageNameValidatorString = @"^[A-Za-z][ ._\-A-Za-z0-9]{1,61}[A-Z-a-z0-9]$";
3436

3537
protected const string IPv4ValidatorString = @"^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$";
3638

src/ServiceManagement/RemoteApp/Commands.RemoteApp/TemplateImage/GetAzureRemoteAppTemplateImage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class GetAzureRemoteAppTemplateImage : GoldImage
2727
Position = 0,
2828
ValueFromPipeline = true,
2929
HelpMessage = "Template image name. Wildcards are permitted.")]
30-
[ValidateNotNullOrEmpty()]
30+
[ValidatePattern(ListTemplateImageNameValidatorString)]
3131
public string ImageName { get; set; }
3232

3333
private bool showAllImages = false;

src/ServiceManagement/RemoteApp/Commands.RemoteApp/TemplateImage/NewAzureRemoteAppTemplateImage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class NewAzureRemoteAppTemplateImage : GoldImage
4343
Position = 0,
4444
ValueFromPipeline = true,
4545
HelpMessage = "Template image name")]
46+
[ValidatePattern(TemplateImageNameValidatorString)]
4647
public string ImageName { get; set; }
4748

4849
[Parameter(Mandatory = true,

src/ServiceManagement/RemoteApp/Commands.RemoteApp/TemplateImage/RemoveAzureRemoteAppTemplateImage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class RemoveAzureRemoteAppTemplateImage : GoldImage
2727
Position = 0,
2828
ValueFromPipeline = true,
2929
HelpMessage = "Template image name")]
30-
30+
[ValidatePattern(TemplateImageNameValidatorString)]
3131
public string ImageName { get; set; }
3232

3333
public override void ExecuteCmdlet()

src/ServiceManagement/RemoteApp/Commands.RemoteApp/TemplateImage/RenameAzureRemoteAppTemplateImage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class RenameAzureRemoteAppTemplateImage : GoldImage
2727
Position = 0,
2828
ValueFromPipeline = true,
2929
HelpMessage = "Template image name")]
30+
[ValidatePattern(TemplateImageNameValidatorString)]
3031
public string ImageName { get; set; }
3132

3233
[Parameter(Mandatory = true,

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Vnet/ResetAzureRemoteAppVpnSharedKey.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,17 @@ public override void ExecuteCmdlet()
6262
{
6363
VNetResult vnet = CallClient(() => Client.VNet.Get(VNetName, true), Client.VNet);
6464
WriteObject(vnet.VNet);
65-
66-
WriteVerboseWithTimestamp("The request completed successfully." +
67-
" Call Get-AzureRemoteAppVpnDeviceConfigScript to download the script and pass in the SharedKey returned by this cmdlet");
65+
WriteVerboseWithTimestamp(Commands_RemoteApp.RequestSuccessful);
6866
}
6967
else
7068
{
7169
if (maxRetries > 0)
7270
{
73-
WriteErrorWithTimestamp("The request failed.");
71+
WriteErrorWithTimestamp(Commands_RemoteApp.RequestFailed);
7472
}
7573
else
7674
{
77-
WriteErrorWithTimestamp("The request took a long time to complete.");
75+
WriteErrorWithTimestamp(Commands_RemoteApp.VNetTimeout);
7876
}
7977
}
8078
}

0 commit comments

Comments
 (0)