diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs index 8208a8b9a1a6..14d943907165 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs @@ -76,6 +76,12 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineChefExtensionCmdletB [ValidateNotNullOrEmpty] public string OrganizationName { get; set; } + [Parameter( + ValueFromPipelineByPropertyName = true, + HelpMessage = "Flag to opt for auto chef-client update. Chef-client update is false by default.")] + [ValidateNotNullOrEmpty] + public SwitchParameter AutoUpdateClient { get; set; } + [Parameter( Mandatory = true, ParameterSetName = LinuxParameterSetName, @@ -141,6 +147,7 @@ private void SetPublicConfig() bool IsChefServerUrlEmpty = string.IsNullOrEmpty(this.ChefServerUrl); bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName); bool IsRunListEmpty = string.IsNullOrEmpty(this.RunList); + string AutoUpdateClient = this.AutoUpdateClient.IsPresent ? "true" : "false"; //Cases handled: // 1. When clientRb given by user and: @@ -192,14 +199,16 @@ private void SetPublicConfig() if (IsRunListEmpty) { - this.PublicConfiguration = string.Format("{{{0}}}", + this.PublicConfiguration = string.Format("{{{0},{1}}}", + string.Format(AutoUpdateTemplate, AutoUpdateClient), string.Format(ClientRbTemplate, ClientConfig)); } else { - this.PublicConfiguration = string.Format("{{{0},{1}}}", - string.Format(ClientRbTemplate, ClientConfig), - string.Format(RunListTemplate, this.RunList)); + this.PublicConfiguration = string.Format("{{{0},{1},{2}}}", + string.Format(AutoUpdateTemplate, AutoUpdateClient), + string.Format(ClientRbTemplate, ClientConfig), + string.Format(RunListTemplate, this.RunList)); } } @@ -223,4 +232,4 @@ protected override void ProcessRecord() ExecuteCommand(); } } -} \ No newline at end of file +} diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs index edef71c6b0e9..3dcd2e58393d 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs @@ -22,6 +22,7 @@ public class VirtualMachineChefExtensionCmdletBase : VirtualMachineExtensionCmdl protected const string ExtensionDefaultName = "ChefClient"; protected const string LinuxExtensionName = "LinuxChefClient"; protected const string PrivateConfigurationTemplate = "{{\"validation_key\":\"{0}\"}}"; + protected const string AutoUpdateTemplate = "\"autoUpdateClient\":\"{0}\""; protected const string ClientRbTemplate = "\"client_rb\":\"{0}\""; protected const string RunListTemplate = "\"runlist\": \"\\\"{0}\\\"\""; @@ -44,4 +45,4 @@ protected string GetPlatformSpecificExtensionName() else { return null; } } } -} \ No newline at end of file +} diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml b/src/ServiceManagement/Compute/Commands.ServiceManagement/Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml index 182e82e58aa7..a9909af1b892 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml @@ -32701,6 +32701,17 @@ PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "Con + + AutoUpdateClient + + Flag to opt for auto chef-client update. Chef-client update is false by default. + + + Boolean + + + false + Linux