Skip to content

Commit 989fe08

Browse files
committed
Merge pull request #31 from ClogenyTechnologies/sid/chef-client-autoUpdate
[Set-AzureVMChefExtension cmdlets] Add AutoUpdateClient option to SetAzureVMChefExtension cmdlets
2 parents 6601143 + 332aad7 commit 989fe08

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineChefExtensionCmdletB
7676
[ValidateNotNullOrEmpty]
7777
public string OrganizationName { get; set; }
7878

79+
[Parameter(
80+
ValueFromPipelineByPropertyName = true,
81+
HelpMessage = "Flag to opt for auto chef-client update. Chef-client update is false by default.")]
82+
[ValidateNotNullOrEmpty]
83+
public SwitchParameter AutoUpdateClient { get; set; }
84+
7985
[Parameter(
8086
Mandatory = true,
8187
ParameterSetName = LinuxParameterSetName,
@@ -141,6 +147,7 @@ private void SetPublicConfig()
141147
bool IsChefServerUrlEmpty = string.IsNullOrEmpty(this.ChefServerUrl);
142148
bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName);
143149
bool IsRunListEmpty = string.IsNullOrEmpty(this.RunList);
150+
string AutoUpdateClient = this.AutoUpdateClient.IsPresent ? "true" : "false";
144151

145152
//Cases handled:
146153
// 1. When clientRb given by user and:
@@ -192,14 +199,16 @@ private void SetPublicConfig()
192199

193200
if (IsRunListEmpty)
194201
{
195-
this.PublicConfiguration = string.Format("{{{0}}}",
202+
this.PublicConfiguration = string.Format("{{{0},{1}}}",
203+
string.Format(AutoUpdateTemplate, AutoUpdateClient),
196204
string.Format(ClientRbTemplate, ClientConfig));
197205
}
198206
else
199207
{
200-
this.PublicConfiguration = string.Format("{{{0},{1}}}",
201-
string.Format(ClientRbTemplate, ClientConfig),
202-
string.Format(RunListTemplate, this.RunList));
208+
this.PublicConfiguration = string.Format("{{{0},{1},{2}}}",
209+
string.Format(AutoUpdateTemplate, AutoUpdateClient),
210+
string.Format(ClientRbTemplate, ClientConfig),
211+
string.Format(RunListTemplate, this.RunList));
203212
}
204213
}
205214

@@ -223,4 +232,4 @@ protected override void ProcessRecord()
223232
ExecuteCommand();
224233
}
225234
}
226-
}
235+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class VirtualMachineChefExtensionCmdletBase : VirtualMachineExtensionCmdl
2222
protected const string ExtensionDefaultName = "ChefClient";
2323
protected const string LinuxExtensionName = "LinuxChefClient";
2424
protected const string PrivateConfigurationTemplate = "{{\"validation_key\":\"{0}\"}}";
25+
protected const string AutoUpdateTemplate = "\"autoUpdateClient\":\"{0}\"";
2526
protected const string ClientRbTemplate = "\"client_rb\":\"{0}\"";
2627
protected const string RunListTemplate = "\"runlist\": \"\\\"{0}\\\"\"";
2728

@@ -44,4 +45,4 @@ protected string GetPlatformSpecificExtensionName()
4445
else { return null; }
4546
}
4647
}
47-
}
48+
}

src/ServiceManagement/Compute/Commands.ServiceManagement/Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32701,6 +32701,17 @@ PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "Con
3270132701
</dev:type>
3270232702
<dev:defaultValue></dev:defaultValue>
3270332703
</command:parameter>
32704+
<command:parameter required="false" variableLength="false" globbing="false" position="named">
32705+
<maml:name>AutoUpdateClient</maml:name>
32706+
<maml:description>
32707+
<maml:para>Flag to opt for auto chef-client update. Chef-client update is false by default.</maml:para>
32708+
</maml:description>
32709+
<dev:type>
32710+
<maml:name>Boolean</maml:name>
32711+
<maml:uri/>
32712+
</dev:type>
32713+
<dev:defaultValue>false</dev:defaultValue>
32714+
</command:parameter>
3270432715
<command:parameter required="true" variableLength="false" globbing="false" position="named">
3270532716
<maml:name>Linux</maml:name>
3270632717
<maml:description>

0 commit comments

Comments
 (0)