Skip to content

Commit 503c9c4

Browse files
author
NimishaS
committed
Removed unwanted options and updated help file
1 parent c4dac2f commit 503c9c4

File tree

3 files changed

+496
-47
lines changed

3 files changed

+496
-47
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/Chef/GetAzureRmVMChefExtension.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public override void ExecuteCmdlet()
100100
{
101101
this.Name = chefExtension.Name;
102102
}
103-
}
103+
}
104104

105105
AzureOperationResponse<VirtualMachineExtension> virtualMachineExtensionGetResponse = null;
106106
if (Status.IsPresent)
@@ -117,7 +117,7 @@ public override void ExecuteCmdlet()
117117
this.Name).GetAwaiter().GetResult();
118118
}
119119

120-
var returnedExtension = virtualMachineExtensionGetResponse.ToPSVirtualMachineExtension(this.ResourceGroupName);
120+
var returnedExtension = virtualMachineExtensionGetResponse.ToPSVirtualMachineExtension(this.ResourceGroupName, this.VMName);
121121
WriteObject(returnedExtension);
122122
});
123123
}

src/ResourceManager/Compute/Commands.Compute/Extension/Chef/SetAzureVMChefExtension.cs

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
using AutoMapper;
22
using Microsoft.Azure.Commands.Compute.Common;
33
using Microsoft.Azure.Commands.Compute.Models;
4-
using Microsoft.Azure.Management.Compute;
54
using Microsoft.Azure.Management.Compute.Models;
6-
using System.Management.Automation;
7-
using System.Text.RegularExpressions;
8-
using System.Collections;
9-
using System.Linq;
105
using System;
6+
using System.Collections;
117
using System.IO;
8+
using System.Linq;
9+
using System.Management.Automation;
1210

1311
namespace Microsoft.Azure.Commands.Compute.Extension.Chef
1412
{
@@ -31,10 +29,7 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineExtensionBaseCmdlet
3129
private Hashtable privateConfiguration;
3230

3331
private string PrivateConfigurationTemplate = "validation_key";
34-
private string AutoUpdateTemplate = "autoUpdateClient";
35-
private string DeleteChefConfigTemplate = "deleteChefConfig";
3632
private string BootstrapVersionTemplate = "bootstrap_version";
37-
private string UninstallChefClientTemplate = "uninstallChefClient";
3833
private string ClientRbTemplate = "client_rb";
3934
private string BootStrapOptionsTemplate = "bootstrap_options";
4035
private string RunListTemplate = "runlist";
@@ -117,30 +112,12 @@ public string TypeHandlerVersion
117112
[ValidateNotNullOrEmpty]
118113
public string OrganizationName { get; set; }
119114

120-
[Parameter(
121-
ValueFromPipelineByPropertyName = true,
122-
HelpMessage = "Flag to opt for auto chef-client update. Chef-client update is false by default.")]
123-
[ValidateNotNullOrEmpty]
124-
public SwitchParameter AutoUpdateChefClient { get; set; }
125-
126-
[Parameter(
127-
ValueFromPipelineByPropertyName = true,
128-
HelpMessage = "Delete the chef config files during update/uninstall extension. Default is false.")]
129-
[ValidateNotNullOrEmpty]
130-
public SwitchParameter DeleteChefConfig { get; set; }
131-
132115
[Parameter(
133116
ValueFromPipelineByPropertyName = true,
134117
HelpMessage = "Chef client version to be installed with the extension. Works for only linux.")]
135118
[ValidateNotNullOrEmpty]
136119
public string BootstrapVersion { get; set; }
137120

138-
[Parameter(
139-
ValueFromPipelineByPropertyName = true,
140-
HelpMessage = "Uninstall Chef client during update/uninstall extension. Default is false.")]
141-
[ValidateNotNullOrEmpty]
142-
public SwitchParameter UninstallChefClient { get; set; }
143-
144121
[Parameter(
145122
Mandatory = true,
146123
ParameterSetName = LinuxParameterSetName,
@@ -221,10 +198,7 @@ private Hashtable PublicConfiguration
221198
bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName);
222199
bool IsRunListEmpty = string.IsNullOrEmpty(this.RunList);
223200
bool IsBootstrapOptionsEmpty = string.IsNullOrEmpty(this.BootstrapOptions);
224-
string AutoUpdateChefClient = this.AutoUpdateChefClient.IsPresent ? "true" : "false";
225-
string DeleteChefConfig = this.DeleteChefConfig.IsPresent ? "true" : "false";
226201
string BootstrapVersion = string.IsNullOrEmpty(this.BootstrapVersion) ? "" : this.BootstrapVersion;
227-
string UninstallChefClient = this.UninstallChefClient.IsPresent ? "true" : "false";
228202

229203
//Cases handled:
230204
// 1. When clientRb given by user and:
@@ -277,20 +251,14 @@ private Hashtable PublicConfiguration
277251
if (IsBootstrapOptionsEmpty)
278252
{
279253
var hashTable = new Hashtable();
280-
hashTable.Add(AutoUpdateTemplate, AutoUpdateChefClient);
281-
hashTable.Add(DeleteChefConfigTemplate, DeleteChefConfig);
282254
hashTable.Add(BootstrapVersionTemplate, BootstrapVersion);
283-
hashTable.Add(UninstallChefClientTemplate, UninstallChefClient);
284255
hashTable.Add(ClientRbTemplate, ClientConfig);
285256
this.publicConfiguration = hashTable;
286257
}
287258
else
288259
{
289260
var hashTable = new Hashtable();
290-
hashTable.Add(AutoUpdateTemplate, AutoUpdateChefClient);
291-
hashTable.Add(DeleteChefConfigTemplate, DeleteChefConfig);
292261
hashTable.Add(BootstrapVersionTemplate, BootstrapVersion);
293-
hashTable.Add(UninstallChefClientTemplate, UninstallChefClient);
294262
hashTable.Add(ClientRbTemplate, ClientConfig);
295263
hashTable.Add(BootStrapOptionsTemplate, this.BootstrapOptions);
296264
this.publicConfiguration = hashTable;
@@ -301,25 +269,19 @@ private Hashtable PublicConfiguration
301269
if (IsBootstrapOptionsEmpty)
302270
{
303271
var hashTable = new Hashtable();
304-
hashTable.Add(AutoUpdateTemplate, AutoUpdateChefClient);
305-
hashTable.Add(DeleteChefConfigTemplate, DeleteChefConfig);
306272
hashTable.Add(BootstrapVersionTemplate, BootstrapVersion);
307-
hashTable.Add(UninstallChefClientTemplate, UninstallChefClient);
308273
hashTable.Add(ClientRbTemplate, ClientConfig);
309274
hashTable.Add(RunListTemplate, this.RunList);
310275
this.publicConfiguration = hashTable;
311276
}
312277
else
313278
{
314279
var hashTable = new Hashtable();
315-
hashTable.Add(AutoUpdateTemplate, AutoUpdateChefClient);
316-
hashTable.Add(DeleteChefConfigTemplate, DeleteChefConfig);
317280
hashTable.Add(BootstrapVersionTemplate, BootstrapVersion);
318-
hashTable.Add(UninstallChefClientTemplate, UninstallChefClient);
319281
hashTable.Add(ClientRbTemplate, ClientConfig);
320282
hashTable.Add(RunListTemplate, this.RunList);
321283
hashTable.Add(BootStrapOptionsTemplate, this.BootstrapOptions);
322-
this.publicConfiguration = hashTable;
284+
this.publicConfiguration = hashTable;
323285
}
324286
}
325287
}
@@ -337,7 +299,7 @@ private Hashtable PrivateConfiguration
337299
var hashTable = new Hashtable();
338300
hashTable.Add(PrivateConfigurationTemplate, File.ReadAllText(this.ValidationPem).TrimEnd('\r', '\n'));
339301
this.privateConfiguration = hashTable;
340-
}
302+
}
341303

342304
return this.privateConfiguration;
343305
}
@@ -349,7 +311,7 @@ private void ExecuteCommand()
349311
{
350312
var parameters = new VirtualMachineExtension
351313
{
352-
Location = this.Location,
314+
Location = this.Location,
353315
Settings = this.PublicConfiguration,
354316
ProtectedSettings = this.PrivateConfiguration,
355317
Publisher = ExtensionDefaultPublisher,
@@ -415,7 +377,7 @@ private string GetLatestChefExtensionVersion()
415377
}
416378

417379
private void ValidateParameters()
418-
{
380+
{
419381
bool IsClientRbEmpty = string.IsNullOrEmpty(this.ClientRb);
420382
bool IsChefServerUrlEmpty = string.IsNullOrEmpty(this.ChefServerUrl);
421383
bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName);

0 commit comments

Comments
 (0)