Skip to content

Commit 37e44bd

Browse files
committed
Merge pull request #417 from huangpf/dev
HPF PR: vmss <- huangpf:dev
2 parents 88b7c6b + aa6553a commit 37e44bd

File tree

11 files changed

+1330
-2750
lines changed

11 files changed

+1330
-2750
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/DscExtensionTests.ps1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,21 @@ function Test-GetAzureRmVMDscExtension
5656
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
5757

5858
# OS & Image
59-
$user = "Foo12";
60-
$password = 'BaR@123' + $rgname;
59+
$user = "localadmin";
60+
$password = 'Bull_dog1';
6161
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
6262
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
6363
$computerName = 'test';
6464
$vhdContainer = "https://$stoname.blob.core.windows.net/test";
6565

6666
$p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent;
67-
68-
$imgRef = Get-DefaultCRPWindowsImageOffline;
69-
$p = ($imgRef | Set-AzureRmVMSourceImage -VM $p);
70-
67+
$p = Set-AzureRmVMSourceImage -VM $p -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2012-R2-Datacenter -Version "latest"
68+
7169
# Virtual Machine
7270
New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p;
7371

7472
# Test DSC Extension
75-
$version = '2.8';
73+
$version = '2.13';
7674

7775
# Publish DSC Configuration
7876
#TODO: Find a way to mock calls with storage

src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DscExtensionTests/TestGetAzureRmVMDscExtension.json

Lines changed: 1069 additions & 2721 deletions
Large diffs are not rendered by default.

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/RemoveAzureVMDscExtensionCommand.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public override void ExecuteCmdlet()
5959
//Add retry logic due to CRP service restart known issue CRP bug: 3564713
6060
var count = 1;
6161
Rest.Azure.AzureOperationResponse op = null;
62-
while (count <= 2)
62+
63+
while (true)
6364
{
6465
op = VirtualMachineExtensionClient.DeleteWithHttpMessagesAsync(
6566
ResourceGroupName,
@@ -70,12 +71,15 @@ public override void ExecuteCmdlet()
7071
//&& op.Error != null && "InternalExecutionError".Equals(op.Error.Code))
7172
{
7273
count++;
74+
if (count <= 2)
75+
{
76+
continue;
77+
}
7378
}
74-
else
75-
{
76-
break;
77-
}
79+
80+
break;
7881
}
82+
7983
var result = Mapper.Map<PSAzureOperationResponse>(op);
8084
WriteObject(result);
8185
}

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ private void CreateConfiguration()
366366
//Add retry logic due to CRP service restart known issue CRP bug: 3564713
367367
var count = 1;
368368
Rest.Azure.AzureOperationResponse<VirtualMachineExtension> op = null;
369-
while (count <= 2)
369+
370+
while (true)
370371
{
371372
try
372373
{
@@ -375,6 +376,8 @@ private void CreateConfiguration()
375376
VMName,
376377
Name ?? DscExtensionCmdletConstants.ExtensionPublishedNamespace + "." + DscExtensionCmdletConstants.ExtensionPublishedName,
377378
parameters).GetAwaiter().GetResult();
379+
380+
break;
378381
}
379382
catch (Rest.Azure.CloudException ex)
380383
{
@@ -385,13 +388,16 @@ private void CreateConfiguration()
385388
&& errorReturned.Error != null && "InternalExecutionError".Equals(errorReturned.Error.Code))
386389
{
387390
count++;
391+
if (count <= 2)
392+
{
393+
continue;
394+
}
388395
}
389-
else
390-
{
391-
break;
392-
}
396+
397+
ThrowTerminatingError(new ErrorRecord(ex, "InvalidResult", ErrorCategory.InvalidResult, null));
393398
}
394399
}
400+
395401
var result = Mapper.Map<PSAzureOperationResponse>(op);
396402
WriteObject(result);
397403
}

src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<Compile Include="JobCommands\StopAzureHDInsightJobCommand.cs" />
5252
<Compile Include="JobCommands\StartAzureHDInsightJobCommand.cs" />
5353
<Compile Include="ManagementCommands\SetAzureHDInsightDefaultStorageCommand.cs" />
54-
<Compile Include="ManagementCommands\NewAzureHDInsightClusterIdentity.cs" />
54+
<Compile Include="ManagementCommands\AddAzureHDInsightClusterIdentity.cs" />
5555
<Compile Include="ManagementCommands\AddAzureHDInsightStorageCommand.cs" />
5656
<Compile Include="ManagementCommands\AddAzureHDInsightScriptActionCommand.cs" />
5757
<Compile Include="ManagementCommands\AddAzureHDInsightMetastoreCommand.cs" />

src/ResourceManager/HDInsight/Commands.HDInsight/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static class CommandNames
3131
public const string AzureHDInsightJobOutput = "AzureRmHDInsightJobOutput";
3232
public const string AzureHDInsightDefaultStorage = "AzureRmHDInsightDefaultStorage";
3333
public const string AzureHDInsightHiveJob = "AzureRmHDInsightHiveJob";
34-
public const string AzureHDInsightClusterIdentity = "AzureHDInsightClusterIdentity";
34+
public const string AzureHDInsightClusterIdentity = "AzureRmHDInsightClusterIdentity";
3535
public const string Hive = "Hive";
3636
}
3737

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
namespace Microsoft.Azure.Commands.HDInsight.ManagementCommands
2121
{
2222
[Cmdlet(
23-
VerbsCommon.New,
23+
VerbsCommon.Add,
2424
Constants.CommandNames.AzureHDInsightClusterIdentity),
2525
OutputType(typeof(AzureHDInsightConfig))]
26-
public class NewAzureHDInsightClusterIdentity : HDInsightCmdletBase
26+
public class AddAzureHDInsightClusterIdentity : HDInsightCmdletBase
2727
{
2828
#region Input Parameter Definitions
2929

src/ResourceManager/HDInsight/Commands.HDInsight/Microsoft.Azure.Commands.HDInsight.dll-help.xml

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,193 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<helpItems schema="maml">
3+
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
4+
<command:details>
5+
<command:name>Add-AzureRmHDInsightClusterIdentity</command:name>
6+
<maml:description>
7+
<maml:para>Adds a cluster identity to the Microsoft Azure HDInsight cluster configuration.</maml:para>
8+
</maml:description>
9+
<maml:copyright>
10+
<maml:para />
11+
</maml:copyright>
12+
<command:verb>Add</command:verb>
13+
<command:noun>AzureHDInsightClusterIdentity</command:noun>
14+
<dev:version />
15+
</command:details>
16+
<maml:description>
17+
<maml:para>Adds a cluster identity to the Microsoft Azure HDInsight cluster configuration.</maml:para>
18+
</maml:description>
19+
<command:syntax>
20+
<command:syntaxItem>
21+
<maml:name>Add-AzureRmHDInsightClusterIdentity</maml:name>
22+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="0">
23+
<maml:name>Config</maml:name>
24+
<maml:description>
25+
<maml:para>The HDInsight cluster configuration to use when creating the new cluster.</maml:para>
26+
</maml:description>
27+
<command:parameterValue required="true" variableLength="false">AzureHDInsightConfig</command:parameterValue>
28+
</command:parameter>
29+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1">
30+
<maml:name>ObjectId</maml:name>
31+
<maml:description>
32+
<maml:para>The Service Principal Object Id for accessing Azure Data Lake.</maml:para>
33+
</maml:description>
34+
<command:parameterValue required="true" variableLength="false">Guid</command:parameterValue>
35+
</command:parameter>
36+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2">
37+
<maml:name>CertificateFilePath</maml:name>
38+
<maml:description>
39+
<maml:para>The Service Principal certificate for accessing Azure Data Lake.</maml:para>
40+
</maml:description>
41+
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
42+
</command:parameter>
43+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="3">
44+
<maml:name>CertificatePassword</maml:name>
45+
<maml:description>
46+
<maml:para>The Service Principal certificate password for accessing Azure Data Lake.</maml:para>
47+
</maml:description>
48+
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
49+
</command:parameter>
50+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
51+
<maml:name>AadTenantId</maml:name>
52+
<maml:description>
53+
<maml:para>The Service Principal AAD Tenant Id for accessing Azure Data Lake.</maml:para>
54+
</maml:description>
55+
<command:parameterValue required="false" variableLength="false">Guid</command:parameterValue>
56+
</command:parameter>
57+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
58+
<maml:name>Profile</maml:name>
59+
<maml:description>
60+
<maml:para />
61+
</maml:description>
62+
<command:parameterValue required="true" variableLength="false">AzureProfile</command:parameterValue>
63+
</command:parameter>
64+
</command:syntaxItem>
65+
</command:syntax>
66+
<command:parameters>
67+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="0">
68+
<maml:name>Config</maml:name>
69+
<maml:description>
70+
<maml:para>The HDInsight cluster configuration to use when creating the new cluster.</maml:para>
71+
</maml:description>
72+
<command:parameterValue required="true" variableLength="false">AzureHDInsightConfig</command:parameterValue>
73+
<dev:type>
74+
<maml:name>AzureHDInsightConfig</maml:name>
75+
<maml:uri />
76+
</dev:type>
77+
<dev:defaultValue>
78+
</dev:defaultValue>
79+
</command:parameter>
80+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1">
81+
<maml:name>ObjectId</maml:name>
82+
<maml:description>
83+
<maml:para>The Service Principal Object Id for accessing Azure Data Lake.</maml:para>
84+
</maml:description>
85+
<command:parameterValue required="true" variableLength="false">Guid</command:parameterValue>
86+
<dev:type>
87+
<maml:name>Guid</maml:name>
88+
<maml:uri />
89+
</dev:type>
90+
<dev:defaultValue>
91+
</dev:defaultValue>
92+
</command:parameter>
93+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2">
94+
<maml:name>CertificateFilePath</maml:name>
95+
<maml:description>
96+
<maml:para>The Service Principal certificate for accessing Azure Data Lake.</maml:para>
97+
</maml:description>
98+
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
99+
<dev:type>
100+
<maml:name>String</maml:name>
101+
<maml:uri />
102+
</dev:type>
103+
<dev:defaultValue>
104+
</dev:defaultValue>
105+
</command:parameter>
106+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="3">
107+
<maml:name>CertificatePassword</maml:name>
108+
<maml:description>
109+
<maml:para>The Service Principal certificate password for accessing Azure Data Lake.</maml:para>
110+
</maml:description>
111+
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
112+
<dev:type>
113+
<maml:name>String</maml:name>
114+
<maml:uri />
115+
</dev:type>
116+
<dev:defaultValue>
117+
</dev:defaultValue>
118+
</command:parameter>
119+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
120+
<maml:name>AadTenantId</maml:name>
121+
<maml:description>
122+
<maml:para>The Service Principal AAD Tenant Id for accessing Azure Data Lake.</maml:para>
123+
</maml:description>
124+
<command:parameterValue required="false" variableLength="false">Guid</command:parameterValue>
125+
<dev:type>
126+
<maml:name>Guid</maml:name>
127+
<maml:uri />
128+
</dev:type>
129+
<dev:defaultValue>
130+
</dev:defaultValue>
131+
</command:parameter>
132+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
133+
<maml:name>Profile</maml:name>
134+
<maml:description>
135+
<maml:para />
136+
</maml:description>
137+
<command:parameterValue required="true" variableLength="false">AzureProfile</command:parameterValue>
138+
<dev:type>
139+
<maml:name>AzureProfile</maml:name>
140+
<maml:uri />
141+
</dev:type>
142+
<dev:defaultValue>
143+
</dev:defaultValue>
144+
</command:parameter>
145+
</command:parameters>
146+
<command:inputTypes>
147+
<command:inputType>
148+
<dev:type>
149+
<maml:name>
150+
</maml:name>
151+
<maml:uri>
152+
</maml:uri>
153+
<maml:description />
154+
</dev:type>
155+
<maml:description>
156+
<maml:para />
157+
</maml:description>
158+
</command:inputType>
159+
</command:inputTypes>
160+
<command:returnValues>
161+
<command:returnValue>
162+
<dev:type>
163+
<maml:name>
164+
</maml:name>
165+
<maml:uri>
166+
</maml:uri>
167+
<maml:description />
168+
</dev:type>
169+
<maml:description>
170+
<maml:para />
171+
</maml:description>
172+
</command:returnValue>
173+
</command:returnValues>
174+
<command:terminatingErrors>
175+
</command:terminatingErrors>
176+
<command:nonTerminatingErrors>
177+
</command:nonTerminatingErrors>
178+
<maml:alertSet>
179+
<maml:title>
180+
</maml:title>
181+
<maml:alert>
182+
<maml:para />
183+
<maml:para>Keywords: azure, azurerm, arm, resource, management, manager, hadoop, hdinsight, hd, insight</maml:para>
184+
</maml:alert>
185+
</maml:alertSet>
186+
<command:examples>
187+
</command:examples>
188+
<maml:relatedLinks>
189+
</maml:relatedLinks>
190+
</command:command>
3191
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
4192
<!--Generated by PS Cmdlet Help Editor-->
5193
<command:details>

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineChefExtensionCmdletB
102102
[ValidateNotNullOrEmpty]
103103
public string BootstrapVersion { get; set; }
104104

105+
[Parameter(
106+
ValueFromPipelineByPropertyName = true,
107+
HelpMessage = "Uninstall Chef client during update/uninstall extension. Default is false.")]
108+
[ValidateNotNullOrEmpty]
109+
public SwitchParameter UninstallChefClient { get; set; }
110+
105111
[Parameter(
106112
Mandatory = true,
107113
ParameterSetName = LinuxParameterSetName,
@@ -174,6 +180,7 @@ private void SetPublicConfig()
174180
string AutoUpdateChefClient = this.AutoUpdateChefClient.IsPresent ? "true" : "false";
175181
string DeleteChefConfig = this.DeleteChefConfig.IsPresent ? "true" : "false";
176182
string BootstrapVersion = this.BootstrapVersion;
183+
string UninstallChefClient = this.UninstallChefClient.IsPresent ? "true" : "false";
177184

178185
//Cases handled:
179186
// 1. When clientRb given by user and:
@@ -227,42 +234,46 @@ private void SetPublicConfig()
227234
{
228235
if (IsBootstrapOptionsEmpty)
229236
{
230-
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3}}}",
237+
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4}}}",
231238
string.Format(AutoUpdateTemplate, AutoUpdateChefClient),
232239
string.Format(DeleteChefConfigTemplate, DeleteChefConfig),
233240
string.Format(ClientRbTemplate, ClientConfig),
234-
string.Format(BootstrapVersionTemplate, BootstrapVersion));
241+
string.Format(BootstrapVersionTemplate, BootstrapVersion),
242+
string.Format(UninstallChefClientTemplate, UninstallChefClient));
235243
}
236244
else
237245
{
238-
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4}}}",
246+
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5}}}",
239247
string.Format(AutoUpdateTemplate, AutoUpdateChefClient),
240248
string.Format(DeleteChefConfigTemplate, DeleteChefConfig),
241249
string.Format(ClientRbTemplate, ClientConfig),
242250
string.Format(BootStrapOptionsTemplate, this.BootstrapOptions),
243-
string.Format(BootstrapVersionTemplate, BootstrapVersion));
251+
string.Format(BootstrapVersionTemplate, BootstrapVersion),
252+
string.Format(UninstallChefClientTemplate, UninstallChefClient));
244253
}
245254
}
246255
else
247256
{
248257
if (IsBootstrapOptionsEmpty)
249258
{
250-
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4}}}",
259+
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5}}}",
251260
string.Format(AutoUpdateTemplate, AutoUpdateChefClient),
252261
string.Format(DeleteChefConfigTemplate, DeleteChefConfig),
253262
string.Format(ClientRbTemplate, ClientConfig),
254263
string.Format(RunListTemplate, this.RunList),
255-
string.Format(BootstrapVersionTemplate, BootstrapVersion));
264+
string.Format(BootstrapVersionTemplate, BootstrapVersion),
265+
string.Format(UninstallChefClientTemplate, UninstallChefClient));
256266
}
257267
else
258268
{
259-
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5}}}",
269+
this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5},{6}}}",
260270
string.Format(AutoUpdateTemplate, AutoUpdateChefClient),
261271
string.Format(DeleteChefConfigTemplate, DeleteChefConfig),
262272
string.Format(ClientRbTemplate, ClientConfig),
263273
string.Format(RunListTemplate, this.RunList),
264274
string.Format(BootStrapOptionsTemplate, this.BootstrapOptions),
265-
string.Format(BootstrapVersionTemplate, BootstrapVersion));
275+
string.Format(BootstrapVersionTemplate, BootstrapVersion),
276+
string.Format(UninstallChefClientTemplate, UninstallChefClient));
266277
}
267278
}
268279
}

0 commit comments

Comments
 (0)