Skip to content

Commit 4262678

Browse files
committed
Revert breaking changes and add warning messages for upcoming breaking change.
1 parent eec5d00 commit 4262678

File tree

10 files changed

+72
-82
lines changed

10 files changed

+72
-82
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ function Test-ContainerService
7070
$output = $cslist | Out-String;
7171
Assert-False { $output.Contains("AgentPoolProfiles") };
7272

73-
$st = Remove-AzureRmContainerService -ResourceGroupName $rgname -Name $csName -Force;
73+
#$st = Remove-AzureRmContainerService -ResourceGroupName $rgname -Name $csName -Force;
74+
$st = Remove-AzureRmContainerService -ResourceGroupName $rgname -Name $csName;
7475
}
7576
finally
7677
{
@@ -144,7 +145,8 @@ function Test-ContainerServiceUpdate
144145
-Count 2 `
145146
| Update-AzureRmContainerService;
146147

147-
$st = Get-AzureRmContainerService -ResourceGroupName $rgname -Name $csName | Remove-AzureRmContainerService -Force;
148+
#$st = Get-AzureRmContainerService -ResourceGroupName $rgname -Name $csName | Remove-AzureRmContainerService -Force;
149+
$st = Get-AzureRmContainerService -ResourceGroupName $rgname -Name $csName | Remove-AzureRmContainerService;
148150
}
149151
finally
150152
{

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,10 @@ function Test-VirtualMachineScaleSet
213213
$st = $vmssResult | Restart-AzureRmVmss -InstanceId $instanceListParam;
214214

215215
# Remove
216-
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId 1 -Force;
217-
$st = $vmssResult | Remove-AzureRmVmss -Force;
216+
#$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId 1 -Force;
217+
#$st = $vmssResult | Remove-AzureRmVmss -Force;
218+
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId 1;
219+
$st = $vmssResult | Remove-AzureRmVmss;
218220
}
219221
finally
220222
{
@@ -339,8 +341,10 @@ function Test-VirtualMachineScaleSetReimageUpdate
339341
"Conflict";
340342

341343
# Remove
342-
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId 1 -Force;
343-
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -Force;
344+
#$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId 1 -Force;
345+
#$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -Force;
346+
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId 1;
347+
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
344348
}
345349
finally
346350
{
@@ -536,7 +540,8 @@ function Test-VirtualMachineScaleSetLB
536540
Assert-True { $output.Contains("PlatformUpdateDomain") };
537541
}
538542

539-
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -Force;
543+
#$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -Force;
544+
$st = Remove-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
540545
}
541546
finally
542547
{

src/ResourceManager/Compute/Commands.Compute/Generated/ContainerService/ContainerServiceDeleteMethod.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ public partial class RemoveAzureRmContainerService : InvokeAzureComputeMethodCmd
104104
protected override void ProcessRecord()
105105
{
106106
this.MethodName = "ContainerServiceDelete";
107-
if (ShouldProcess(this.dynamicParameters["ResourceGroupName"].Value.ToString(), VerbsCommon.Remove)
108-
&& (this.dynamicParameters["Force"].IsSet ||
109-
this.ShouldContinue("This cmdlet will remove the specified resource. Do you want to continue?",
110-
"Remove-AzureRmContainerService operation")))
107+
if (ShouldProcess(this.dynamicParameters["ResourceGroupName"].Value.ToString(), VerbsCommon.Remove))
111108
{
109+
WriteWarning("Breaking change notice:'Force' parameter will be added in upcoming release.");
112110
base.ProcessRecord();
113111
}
114112
}
@@ -144,18 +142,6 @@ public override object GetDynamicParameters()
144142
pContainerServiceName.Attributes.Add(new AllowNullAttribute());
145143
dynamicParameters.Add("Name", pContainerServiceName);
146144

147-
var pForce = new RuntimeDefinedParameter();
148-
pForce.Name = "Force";
149-
pForce.ParameterType = typeof(SwitchParameter);
150-
pForce.Attributes.Add(new ParameterAttribute
151-
{
152-
ParameterSetName = "InvokeByDynamicParameters",
153-
Position = 3,
154-
Mandatory = false
155-
});
156-
pForce.Attributes.Add(new AllowNullAttribute());
157-
dynamicParameters.Add("Force", pForce);
158-
159145
return dynamicParameters;
160146
}
161147
}

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetDeleteInstancesMethod.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,9 @@ public partial class RemoveAzureRmVmss : InvokeAzureComputeMethodCmdlet
131131
protected override void ProcessRecord()
132132
{
133133
this.MethodName = "VirtualMachineScaleSetDeleteInstances";
134-
if (ShouldProcess(this.dynamicParameters["ResourceGroupName"].Value.ToString(), VerbsCommon.Remove)
135-
&& (this.dynamicParameters["Force"].IsSet ||
136-
this.ShouldContinue("This cmdlet will remove the specified resource. Do you want to continue?",
137-
"Remove-AzureRmVmss operation")))
134+
if (ShouldProcess(this.dynamicParameters["ResourceGroupName"].Value.ToString(), VerbsCommon.Remove))
138135
{
136+
WriteWarning("Breaking change notice:'Force' parameter will be added in upcoming next release.");
139137
base.ProcessRecord();
140138
}
141139
}
@@ -186,18 +184,6 @@ public override object GetDynamicParameters()
186184
pInstanceIds.Attributes.Add(new AllowNullAttribute());
187185
dynamicParameters.Add("InstanceId", pInstanceIds);
188186

189-
var pForce = new RuntimeDefinedParameter();
190-
pForce.Name = "Force";
191-
pForce.ParameterType = typeof(SwitchParameter);
192-
pForce.Attributes.Add(new ParameterAttribute
193-
{
194-
ParameterSetName = "InvokeByDynamicParameters",
195-
Position = 4,
196-
Mandatory = false
197-
});
198-
pForce.Attributes.Add(new AllowNullAttribute());
199-
dynamicParameters.Add("Force", pForce);
200-
201187
return dynamicParameters;
202188
}
203189
}

src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8255,14 +8255,6 @@ PatchCategory : Important</dev:code>
82558255
<maml:uri /></dev:type>
82568256
<dev:defaultValue>None</dev:defaultValue>
82578257
</command:parameter>
8258-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Force</maml:name>
8259-
<maml:Description><maml:para>Forces the command to run without asking for user confirmation.
8260-
</maml:para>
8261-
</maml:Description>
8262-
<dev:type><maml:name>SwitchParameter</maml:name>
8263-
<maml:uri /></dev:type>
8264-
<dev:defaultValue>False</dev:defaultValue>
8265-
</command:parameter>
82668258
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name>
82678259
<maml:Description><maml:para>Prompts you for confirmation before running the cmdlet.
82688260
</maml:para>
@@ -8281,16 +8273,7 @@ PatchCategory : Important</dev:code>
82818273
</command:parameter>
82828274
</command:syntaxItem>
82838275
</command:syntax>
8284-
<command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Force</maml:name>
8285-
<maml:Description><maml:para>Forces the command to run without asking for user confirmation.
8286-
</maml:para>
8287-
</maml:Description>
8288-
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
8289-
<dev:type><maml:name>SwitchParameter</maml:name>
8290-
<maml:uri /></dev:type>
8291-
<dev:defaultValue>False</dev:defaultValue>
8292-
</command:parameter>
8293-
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="3" aliases="none"><maml:name>Name</maml:name>
8276+
<command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="3" aliases="none"><maml:name>Name</maml:name>
82948277
<maml:Description><maml:para>Specifies the name of the container service that this cmdlet removes.
82958278
</maml:para>
82968279
</maml:Description>
@@ -9342,7 +9325,7 @@ PS C:\&gt; Remove-AzureRmContainerServiceAgentPoolProfile -ContainerService $Con
93429325
<maml:uri /></dev:type>
93439326
<dev:defaultValue>None</dev:defaultValue>
93449327
</command:parameter>
9345-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="Name"><maml:name>DataDiskNames</maml:name>
9328+
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="Name"><maml:name>DataDiskNames</maml:name>
93469329
<maml:Description><maml:para>Specifies the names of one or more data disks that this cmdlet removes.
93479330
</maml:para>
93489331
</maml:Description>
@@ -9369,7 +9352,7 @@ PS C:\&gt; Remove-AzureRmContainerServiceAgentPoolProfile -ContainerService $Con
93699352
</command:parameter>
93709353
</command:syntaxItem>
93719354
</command:syntax>
9372-
<command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="Name"><maml:name>DataDiskNames</maml:name>
9355+
<command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="Name"><maml:name>DataDiskNames</maml:name>
93739356
<maml:Description><maml:para>Specifies the names of one or more data disks that this cmdlet removes.
93749357
</maml:para>
93759358
</maml:Description>
@@ -9971,7 +9954,7 @@ PS C:\&gt; Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualM
99719954
<maml:uri /></dev:type>
99729955
<dev:defaultValue>None</dev:defaultValue>
99739956
</command:parameter>
9974-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="Id, NicIds"><maml:name>NetworkInterfaceIDs</maml:name>
9957+
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="Id, NicIds"><maml:name>NetworkInterfaceIDs</maml:name>
99759958
<maml:Description><maml:para>Specifies an array of network interface IDs that this cmdlet removes.
99769959
</maml:para>
99779960
</maml:Description>
@@ -9998,7 +9981,7 @@ PS C:\&gt; Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualM
99989981
</command:parameter>
99999982
</command:syntaxItem>
100009983
</command:syntax>
10001-
<command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="Id, NicIds"><maml:name>NetworkInterfaceIDs</maml:name>
9984+
<command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="Id, NicIds"><maml:name>NetworkInterfaceIDs</maml:name>
100029985
<maml:Description><maml:para>Specifies an array of network interface IDs that this cmdlet removes.
100039986
</maml:para>
100049987
</maml:Description>
@@ -10300,14 +10283,6 @@ PS C:\&gt; Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualM
1030010283
<maml:uri /></dev:type>
1030110284
<dev:defaultValue>None</dev:defaultValue>
1030210285
</command:parameter>
10303-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Force</maml:name>
10304-
<maml:Description><maml:para>Forces the command to run without asking for user confirmation.
10305-
</maml:para>
10306-
</maml:Description>
10307-
<dev:type><maml:name>SwitchParameter</maml:name>
10308-
<maml:uri /></dev:type>
10309-
<dev:defaultValue>False</dev:defaultValue>
10310-
</command:parameter>
1031110286
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name>
1031210287
<maml:Description><maml:para>Prompts you for confirmation before running the cmdlet.
1031310288
</maml:para>
@@ -10326,16 +10301,7 @@ PS C:\&gt; Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualM
1032610301
</command:parameter>
1032710302
</command:syntaxItem>
1032810303
</command:syntax>
10329-
<command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Force</maml:name>
10330-
<maml:Description><maml:para>Forces the command to run without asking for user confirmation.
10331-
</maml:para>
10332-
</maml:Description>
10333-
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
10334-
<dev:type><maml:name>SwitchParameter</maml:name>
10335-
<maml:uri /></dev:type>
10336-
<dev:defaultValue>False</dev:defaultValue>
10337-
</command:parameter>
10338-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="4" aliases="none"><maml:name>InstanceId</maml:name>
10304+
<command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="4" aliases="none"><maml:name>InstanceId</maml:name>
1033910305
<maml:Description><maml:para>Specifies, as a string array, the ID of the instances that need to be started. For instance: -InstanceId "0", "3"
1034010306
</maml:para>
1034110307
</maml:Description>

src/ResourceManager/Compute/Commands.Compute/Models/PSVirtualMachine.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,36 @@ public string ResourceGroupName
9191
// Gets or sets the storage profile.
9292
public StorageProfile StorageProfile { get; set; }
9393

94+
[JsonIgnore]
95+
public string[] DataDiskNames
96+
{
97+
get
98+
{
99+
if (this.StorageProfile == null || this.StorageProfile.DataDisks == null) return null;
100+
var listStr = new List<string>();
101+
foreach (var item in StorageProfile.DataDisks)
102+
{
103+
listStr.Add(item.Name);
104+
}
105+
return listStr.ToArray();
106+
}
107+
}
108+
109+
[JsonIgnore]
110+
public string[] NetworkInterfaceIDs
111+
{
112+
get
113+
{
114+
if (this.NetworkProfile == null || this.NetworkProfile.NetworkInterfaces == null) return null;
115+
var listStr = new List<string>();
116+
foreach (var item in NetworkProfile.NetworkInterfaces)
117+
{
118+
listStr.Add(item.Id);
119+
}
120+
return listStr.ToArray();
121+
}
122+
}
123+
94124
public DisplayHintType DisplayHint { get; set; }
95125

96126
}

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/RemoveAzureVMDataDiskCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ public class RemoveAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceMan
4040

4141
[Alias("Name")]
4242
[Parameter(
43-
Mandatory = false,
43+
Mandatory = true,
4444
Position = 1,
45+
ValueFromPipelineByPropertyName = true,
4546
HelpMessage = HelpMessages.VMDataDiskName)]
4647
[ValidateNotNullOrEmpty]
4748
public string[] DataDiskNames { get; set; }
@@ -50,6 +51,8 @@ public override void ExecuteCmdlet()
5051
{
5152
if (this.ShouldProcess("DataDisk", VerbsCommon.Remove))
5253
{
54+
WriteWarning("Breaking change notice: In upcoming release, DataDiskNames parameter will no longer support pipeline. This parameter will be optional. All data disks will be removed from a given VM object if a user does not give this parameter.");
55+
5356
var storageProfile = this.VM.StorageProfile;
5457

5558
if (storageProfile != null && storageProfile.DataDisks != null)

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/RemoveAzureVMNetworkInterfaceCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public class RemoveAzureVMNetworkInterfaceCommand : Microsoft.Azure.Commands.Res
4343

4444
[Alias("Id", "NicIds")]
4545
[Parameter(
46-
Mandatory = false,
46+
Mandatory = true,
4747
Position = 1,
48+
ValueFromPipelineByPropertyName = true,
4849
HelpMessage = HelpMessages.VMNetworkInterfaceID)]
4950
[ValidateNotNullOrEmpty]
5051
public string[] NetworkInterfaceIDs { get; set; }
@@ -53,6 +54,8 @@ public override void ExecuteCmdlet()
5354
{
5455
if (this.ShouldProcess("NetworkInterface", VerbsCommon.Remove))
5556
{
57+
WriteWarning("Breaking change notice: In upcoming release, NetworkInterfaceIDs will no longer support pipeline. This parameter will be optional. All network interfaces will be removed from a given VM object if a user does not give this parameter.");
58+
5659
var networkProfile = this.VM.NetworkProfile;
5760

5861
if (NetworkInterfaceIDs == null)

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ public override void ExecuteCmdlet()
7979
{
8080
base.ExecuteCmdlet();
8181

82+
WriteWarning("Breaking change notice: In upcoming releaese, top level properties, DataDiskNames and NetworkInterfaceIDs, will be removed from VM object because they are also in StorageProfile and NetworkProfile, respectively.");
83+
8284
ExecuteClientAction(() =>
8385
{
8486
if (string.IsNullOrEmpty(this.ResourceGroupName) && string.IsNullOrEmpty(this.Name))

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/VirtualMachineBaseCmdlet.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ private static int GetTabLength(Object obj, int max, int depth, List<Tuple<strin
129129

130130
if (propType.IsSerializable)
131131
{
132-
tupleList.Add(MakeTuple(property.Name + "[" + i + "]", elem[i].ToString(), depth));
132+
if (expand)
133+
{
134+
tupleList.Add(MakeTuple(property.Name + "[" + i + "]", elem[i].ToString(), depth));
135+
}
136+
else
137+
{
138+
elementName.Add(elem[i].ToString());
139+
}
133140
}
134141
else
135142
{

0 commit comments

Comments
 (0)