Skip to content

Commit e80bcfd

Browse files
committed
modification for bash tests
1 parent e6ebd8a commit e80bcfd

File tree

8 files changed

+23
-12
lines changed

8 files changed

+23
-12
lines changed

src/CLU/Microsoft.Azure.Commands.Websites.Test/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"Microsoft.Azure.Commands.Websites": "",
2424
"Microsoft.Azure.Management.Authorization": "2.3.0-preview",
2525
"Microsoft.Azure.Management.Resources": "3.3.1-preview",
26-
"Microsoft.Azure.Management.Websites": "1.0.0-preview",
26+
"Microsoft.Azure.Management.Websites": "1.0.2-preview",
2727
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
2828
"Microsoft.Rest.ClientRuntime": "1.8.2",
2929
"Microsoft.Rest.ClientRuntime.Azure": "2.5.4",

src/CLU/Microsoft.Azure.Commands.Websites/Cmdlets/AppServicePlans/RemoveAppServicePlan.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ protected override void ProcessRecord()
3838

3939
ConfirmAction(
4040
Force.IsPresent,
41-
string.Format(Properties.Resources.RemovingAppServicePlan, Name),
42-
Properties.Resources.RemovingAppServicePlan,
41+
string.Format(WebSites.Properties.Resources.RemovingAppServicePlan, Name),
42+
WebSites.Properties.Resources.RemovingAppServicePlan,
4343
Name,
4444
() => WebsitesClient.RemoveAppServicePlan(ResourceGroupName, Name));
4545
}

src/CLU/Microsoft.Azure.Commands.Websites/Cmdlets/DeploymentSlots/RemoveAzureWebAppSlot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ protected override void ProcessRecord()
4343
base.ProcessRecord();
4444
ConfirmAction(
4545
Force.IsPresent,
46-
string.Format(Properties.Resources.RemoveWebappSlotWarning, Name, Slot),
47-
Properties.Resources.RemoveWebappSlotMessage,
46+
string.Format(WebSites.Properties.Resources.RemoveWebappSlotWarning, Name, Slot),
47+
WebSites.Properties.Resources.RemoveWebappSlotMessage,
4848
Name,
4949
() => WebsitesClient.RemoveWebApp(ResourceGroupName, Name, Slot, deleteEmptyServerFarmByDefault, deleteMetricsByDefault, deleteSlotsByDefault));
5050
}

src/CLU/Microsoft.Azure.Commands.Websites/Cmdlets/WebApps/GetAzureWebAppMetrics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class GetAzureWebAppMetricsCmdlet : WebAppBaseCmdlet
4747
protected override void ProcessRecord()
4848
{
4949
base.ProcessRecord();
50-
WriteObject(WebsitesClient.GetWebAppUsageMetrics(ResourceGroupName, Name, null, Metrics, StartTime, EndTime, Granularity, InstanceDetails.IsPresent));
50+
WriteObject(WebsitesClient.GetWebAppUsageMetrics(ResourceGroupName, Name, null, Metrics, StartTime, EndTime, Granularity, InstanceDetails.IsPresent), true);
5151
}
5252
}
5353
}

src/CLU/Microsoft.Azure.Commands.Websites/Cmdlets/WebApps/RemoveAzureWebApp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ protected override void ProcessRecord()
4141
base.ProcessRecord();
4242
ConfirmAction(
4343
Force.IsPresent,
44-
string.Format(Properties.Resources.RemoveWebsiteWarning, Name),
45-
Properties.Resources.RemoveWebsiteMessage,
44+
string.Format(WebSites.Properties.Resources.RemoveWebsiteWarning, Name),
45+
WebSites.Properties.Resources.RemoveWebsiteMessage,
4646
Name,
4747
() =>
4848
{

src/CLU/Microsoft.Azure.Commands.Websites/Cmdlets/WebApps/SetAzureWebApp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class SetAzureWebAppCmdlet : WebAppBaseCmdlet
6868
[Parameter(ParameterSetName = ParameterSet1Name, Position = 10, Mandatory = false, HelpMessage = "Web app connection strings. Example: -ConnectionStrings @{ ConnectionString1 = @{ Type = \"MySql\"; Value = \"MySql Connection string\"}; ConnectionString2 = @{ Type = \"SQLAzure\"; Value = \"SqlAzure Connection string 2\"} }")]
6969
[ValidateNotNullOrEmpty]
7070
[ValidateConnectionStrings]
71-
public Hashtable ConnectionStrings { get; set; }
71+
public Dictionary<string, ConnStringValueTypePair> ConnectionStrings { get; set; }
7272

7373
[Parameter(ParameterSetName = ParameterSet1Name, Position = 11, Mandatory = false, HelpMessage = "Web app handler mappings")]
7474
[ValidateNotNullOrEmpty]
@@ -126,7 +126,7 @@ protected override void ProcessRecord()
126126
}
127127

128128
// Update web app configuration
129-
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, null, siteConfig, AppSettings.ConvertToStringDictionary(), ConnectionStrings.ConvertToConnectionStringDictionary());
129+
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, null, siteConfig, AppSettings.ConvertToStringDictionary(), ConnectionStrings);
130130

131131
if (parameters.Contains("AppServicePlan"))
132132
{

src/CLU/Microsoft.Azure.Commands.Websites/Validations/ValidateConnectionStringsAttribute.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,25 @@
1717
using System.Linq;
1818
using System.Management.Automation;
1919
using System.Text.RegularExpressions;
20+
using Newtonsoft.Json;
2021
using Microsoft.Azure.Management.WebSites.Models;
22+
using Newtonsoft.Json.Linq;
23+
2124

2225
namespace Microsoft.Azure.Commands.WebApps.Validations
2326
{
2427
public class ValidateConnectionStringsAttribute : ValidateArgumentsAttribute
2528
{
2629
protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
2730
{
31+
/*
32+
This would be required for Powershell as it is easy to construct Hashtables in Posh vs Dictionary. For CLU when the user passes
33+
this - "{ \"connstring1\": { \"Type\": \"MySql1212\", \"Value\": \"string value 1\" }}" as the connectionstring then
34+
JsonConvert.Deserialize() correctly converts it into a Dictionary<string, ConnStringValueTypePair>. Inbuilt model validation
35+
in the website MAML library works well. Hence this is not required for CLU. When we port this to master branch then we need to
36+
use #if def and have two definitions for connectionstrings, each for CLU and Powershell resp. as follows:
37+
- public Dictionary<string, ConnStringValueTypePair> ConnectionStrings { get; set; }
38+
- public Hashtable ConnectionStrings { get; set; }
2839
var hashtable = arguments as Hashtable;
2940
if (hashtable == null)
3041
{
@@ -60,7 +71,7 @@ protected override void Validate(object arguments, EngineIntrinsics engineIntrin
6071
{
6172
throw new PSArgumentException("Connection string value must be specified.");
6273
}
63-
}
74+
}*/
6475
}
6576
}
6677
}

src/CLU/Microsoft.Azure.Commands.Websites/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"Microsoft.Azure.Graph.RBAC": "2.1.1-preview",
2727
"Microsoft.Azure.Management.Authorization": "2.3.0-preview",
2828
"Microsoft.Azure.Management.Resources": "3.3.1-preview",
29-
"Microsoft.Azure.Management.Websites": "1.0.0-preview",
29+
"Microsoft.Azure.Management.Websites": "1.0.2-preview",
3030
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
3131
"Microsoft.Rest.ClientRuntime": "1.8.2",
3232
"Microsoft.Rest.ClientRuntime.Azure": "2.5.4",

0 commit comments

Comments
 (0)