Skip to content

Commit dad327e

Browse files
authored
Merge pull request Azure#3889 from chingchenmsft/preview
MD file fixes
2 parents 23351e5 + 19d585d commit dad327e

22 files changed

+2582
-1316
lines changed

src/ResourceManager/ServiceFabric/Commands.ServiceFabric.Test/SessionRecords/Microsoft.Azure.Commands.ServiceFabric.Test.ScenarioTests.TestServiceFabric/TestAddAzureRmServiceFabricNodeType.json

Lines changed: 2459 additions & 1204 deletions
Large diffs are not rendered by default.

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/AddAzureRmServiceFabricNode.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,38 @@ namespace Microsoft.Azure.Commands.ServiceFabric.Commands
2121
[Cmdlet(VerbsCommon.Add, CmdletNoun.AzureRmServiceFabricNode, SupportsShouldProcess = true), OutputType(typeof(PSCluster))]
2222
public class AddAzureRmServiceFabricNode : UpdateAzureRmServiceFabricNodeBase
2323
{
24+
/// <summary>
25+
/// Resource group name
26+
/// </summary>
27+
[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true,
28+
HelpMessage = "Specify the name of the resource group.")]
29+
[ValidateNotNullOrEmpty()]
30+
public override string ResourceGroupName { get; set; }
31+
32+
[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true,
33+
HelpMessage = "Specify the name of the cluster")]
34+
[ValidateNotNullOrEmpty()]
35+
[Alias("ClusterName")]
36+
public override string Name { get; set; }
37+
38+
[Parameter(Mandatory = true, ValueFromPipeline = true,
39+
HelpMessage = "Node type name")]
40+
public override string NodeType { get; set; }
41+
42+
protected override int Number
43+
{
44+
get { return this.NumberOfNodesToAdd; }
45+
}
46+
47+
[Parameter(Mandatory = true, ValueFromPipeline = true,
48+
HelpMessage = "The number of nodes to add")]
49+
[ValidateRange(1, 2147483647)]
50+
[Alias("Number")]
51+
public int NumberOfNodesToAdd
52+
{
53+
get; set;
54+
}
55+
2456
public override void ExecuteCmdlet()
2557
{
2658
if (this.Number < 0)

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/AddAzureRmServiceFabricNodeType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private List<StorageAccount> CreateStorageAccount()
376376
{
377377
var randomName = GetStorageRandomName();
378378
var accounts = new List<StorageAccount>();
379-
for (int i = 0, start = 0; i < this.Capacity; i++)
379+
for (int i = 0, start = 0; i < Constants.StorageAccountsPerNodeType; i++)
380380
{
381381
string accountName = string.Empty;
382382
int retry = 10;

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/NewAzureRmServiceFabricCluster.cs

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class NewAzureRmServiceFabricCluster : ServiceFabricClusterCertificateCmd
4444
public const string LinuxTemplateRelativePath = @"Template\Linux";
4545
public const string ParameterFileName = @"parameter.json";
4646
public const string TemplateFileName = @"template.json";
47-
47+
4848
public readonly Dictionary<OperatingSystem, string> OsToVmSkuString = new Dictionary<OperatingSystem, string>()
4949
{
5050
{OperatingSystem.WindowsServer2012R2Datacenter, "2012-R2-Datacenter"},
@@ -434,8 +434,6 @@ private void DeployWithDefaultTemplate()
434434
ParseTemplate(false);
435435
TranslateParameters(false);
436436
var parameters = (JObject)deployment.Properties.Parameters;
437-
var template = (JObject)deployment.Properties.Template;
438-
deployment.Properties.Template = ModifyDefaultTemplateStorageAccount(ref template);
439437

440438
SetParameter(ref parameters, this.clusterNameParameter, this.Name);
441439

@@ -1041,56 +1039,5 @@ private void CheckValidationResult(DeploymentValidateResult validateResult)
10411039
throw new PSInvalidOperationException(ServiceFabricProperties.Resources.DeploymentFailed);
10421040
}
10431041
}
1044-
1045-
private JObject ModifyDefaultTemplateStorageAccount(ref JObject templateJObject)
1046-
{
1047-
var storageNameArray = templateJObject.SelectToken("variables.uniqueStringArray0", true) as JArray;
1048-
if (storageNameArray == null)
1049-
{
1050-
throw new InvalidOperationException(ServiceFabricProperties.Resources.InvalidTemplateFile);
1051-
}
1052-
1053-
storageNameArray.Clear();
1054-
for (int i = 0; i < this.clusterSize; i++)
1055-
{
1056-
storageNameArray.Add(string.Format("[concat(variables('vmStorageAccountName0'), '{0}')]", i));
1057-
}
1058-
1059-
var resources = templateJObject.SelectToken("resources", true);
1060-
1061-
foreach (var resource in resources)
1062-
{
1063-
if (resource["type"] == null)
1064-
{
1065-
throw new InvalidOperationException(ServiceFabricProperties.Resources.InvalidTemplateFile);
1066-
}
1067-
1068-
var resourceType = resource["type"];
1069-
if (resourceType.ToString().Equals(Constants.VirtualMachineScaleSetsType, StringComparison.OrdinalIgnoreCase))
1070-
{
1071-
var dependsOn = resource.SelectToken("dependsOn", true) as JArray;
1072-
1073-
if (dependsOn == null)
1074-
{
1075-
throw new InvalidOperationException(ServiceFabricProperties.Resources.InvalidTemplateFile);
1076-
}
1077-
1078-
for (int i = 1; i < this.clusterSize; i++)
1079-
{
1080-
dependsOn.Add(string.Format("[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[{0}])]", i));
1081-
}
1082-
1083-
var osDisks = resource.SelectToken("properties.virtualMachineProfile.storageProfile.osDisk.vhdContainers", true) as JArray;
1084-
osDisks.Clear();
1085-
for (int i = 0; i < this.clusterSize; i++)
1086-
{
1087-
osDisks.Add(string.Format(
1088-
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[{0}]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]", i));
1089-
}
1090-
}
1091-
}
1092-
1093-
return templateJObject;
1094-
}
10951042
}
10961043
}

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/RemoveAzureRmServiceFabricNode.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public class RemoveAzureRmServiceFabricNode : UpdateAzureRmServiceFabricNodeBase
4242
public override string NodeType { get; set; }
4343

4444
[Parameter(Mandatory = true, ValueFromPipeline = true,
45-
HelpMessage = "Number of nodes to remove")]
45+
HelpMessage = "The number of nodes to add")]
4646
[ValidateRange(1, 2147483647)]
47-
[Alias("NumberOfNodesToRemove")]
48-
public override int Number
47+
[Alias("Number")]
48+
public int NumberOfNodesToRemove
4949
{
5050
get
5151
{
@@ -55,6 +55,11 @@ public override int Number
5555
{
5656
toRemoveNode = -value;
5757
}
58+
}
59+
60+
protected override int Number
61+
{
62+
get { return this.NumberOfNodesToRemove; }
5863
}
5964

6065
public override void ExecuteCmdlet()

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/UpdateAzureRmServiceFabricNodeBase.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,9 @@ public class UpdateAzureRmServiceFabricNodeBase : ServiceFabricClusterCmdlet
4646
HelpMessage = "Node type name")]
4747
public virtual string NodeType { get; set; }
4848

49-
[Parameter(Mandatory = true, ValueFromPipeline = true,
50-
HelpMessage = "The number of nodes to add")]
51-
[ValidateRange(1, 2147483647)]
52-
[Alias("NumberOfNodesToAdd")]
53-
public virtual int Number
49+
protected virtual int Number
5450
{
55-
get; set;
51+
get;
5652
}
5753

5854
public override void ExecuteCmdlet()

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Common/Constants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public static class Constants
3232
public const int DefaultFrontendPortRangeEnd = 4500;
3333
public const int DefaultBackendPort = 3389;
3434

35+
public const int StorageAccountsPerNodeType = 5;
36+
3537
public const string PublicIpAddressesType = "Microsoft.Network/publicIPAddresses";
3638
public const string VirtualMachineScaleSetsType = "Microsoft.Compute/virtualMachineScaleSets";
3739
public const string KeyVaultType = "Microsoft.KeyVault/vaults";

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Properties/Resources.Designer.cs

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

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Properties/Resources.resx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<value>Can't change durability from {0} {1}</value>
125125
</data>
126126
<data name="CannotDeletePrimayNodeType" xml:space="preserve">
127-
<value>Can not delete primay node type {0}</value>
127+
<value>Can't delete primay node type {0}</value>
128128
</data>
129129
<data name="CannotFindCertificateInCluster" xml:space="preserve">
130130
<value>Can't find the certificate {0} in the cluster</value>
@@ -145,22 +145,22 @@
145145
<value>Can't find the thumbprint {0} in the cluster</value>
146146
</data>
147147
<data name="CannotFindVault" xml:space="preserve">
148-
<value>Can not find key vault {0}</value>
148+
<value>Can't find key vault {0}</value>
149149
</data>
150150
<data name="CannotGetReliabilityLevel" xml:space="preserve">
151151
<value>Can't get reliability level</value>
152152
</data>
153153
<data name="CannotParseReliabilityLevel" xml:space="preserve">
154-
<value>Can not parse reliability level {0}</value>
154+
<value>Can't parse reliability level {0}</value>
155155
</data>
156156
<data name="CannotUpdateBronzeNodeType" xml:space="preserve">
157-
<value>Can't not update node type which durability is bronze,please update it to Silver or above first</value>
157+
<value>Can't update node type which durability is bronze,please update it to Silver or above first</value>
158158
</data>
159159
<data name="CannotUpdateNodeCountLessThenReliabilityLevel" xml:space="preserve">
160160
<value>Can't update nodes count {0} to less than the reliability level {1}</value>
161161
</data>
162162
<data name="CannotUpdateSkuWithBronzeDurability" xml:space="preserve">
163-
<value>Can not update Sku while durability is Bronze , please update durability to Silver or above first</value>
163+
<value>Can't update Sku while durability is Bronze , please update durability to Silver or above first</value>
164164
</data>
165165
<data name="CheckingDeploymentStatus" xml:space="preserve">
166166
<value>Checking deployment status in {0} seconds</value>
@@ -232,13 +232,13 @@
232232
<value>Invalid existing VMSS configuration</value>
233233
</data>
234234
<data name="KeyVaultAndResourceGroupNotSameRegion" xml:space="preserve">
235-
<value>The Key vault and the resource group are not in same region</value>
235+
<value>The key vault and the resource group are not in same region</value>
236236
</data>
237237
<data name="NewExistingCluster" xml:space="preserve">
238238
<value>The cluster {0} exists , please remove the resource group, and try again.</value>
239239
</data>
240240
<data name="NoCertificateOperationReturned" xml:space="preserve">
241-
<value>No CertificateOperation returned when creating self signed certificate in Azure key vault</value>
241+
<value>No certificateOperation returned when creating self signed certificate in Azure key vault</value>
242242
</data>
243243
<data name="NodeTypeAlreadyExist" xml:space="preserve">
244244
<value>Node type {0} already exists in the cluster</value>

src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Template/Linux/template.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@
214214
"vmNodeType0Size": "[parameters('vmSku')]",
215215
"vmStorageAccountName0": "[toLower(concat(uniqueString(resourceGroup().id), '1', '0' ))]",
216216
"uniqueStringArray0": [
217-
"[concat(variables('vmStorageAccountName0'), '0')]"
217+
"[concat(variables('vmStorageAccountName0'), '0')]",
218+
"[concat(variables('vmStorageAccountName0'), '1')]",
219+
"[concat(variables('vmStorageAccountName0'), '2')]",
220+
"[concat(variables('vmStorageAccountName0'), '3')]",
221+
"[concat(variables('vmStorageAccountName0'), '4')]"
218222
],
219223
"wadmetricsresourceid0": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name ,'/providers/','Microsoft.Compute/virtualMachineScaleSets/', variables('vmNodeType0Name'))]"
220224
},
@@ -462,7 +466,7 @@
462466
"properties": {},
463467
"copy": {
464468
"name": "storageLoop",
465-
"count": "[parameters('nt0InstanceCount')]"
469+
"count": 5
466470
},
467471
"kind": "Storage",
468472
"sku": {
@@ -481,6 +485,10 @@
481485
"dependsOn": [
482486
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
483487
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[0])]",
488+
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[1])]",
489+
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[2])]",
490+
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[3])]",
491+
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[4])]",
484492
"[concat('Microsoft.Network/loadBalancers/', concat('LB','-', parameters('clusterName'),'-',variables('vmNodeType0Name')))]",
485493
"[concat('Microsoft.Storage/storageAccounts/', variables('supportLogStorageAccountName'))]",
486494
"[concat('Microsoft.Storage/storageAccounts/', variables('applicationDiagnosticsStorageAccountName'))]"
@@ -591,7 +599,11 @@
591599
},
592600
"osDisk": {
593601
"vhdContainers": [
594-
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[0]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]"
602+
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[0]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]",
603+
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[1]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]",
604+
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[2]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]",
605+
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[3]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]",
606+
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray0')[4]), variables('storageApiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'))]"
595607
],
596608
"name": "vmssosdisk",
597609
"caching": "ReadOnly",

0 commit comments

Comments
 (0)