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 33f20d84c544..3e5959706da9 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs @@ -102,6 +102,12 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineChefExtensionCmdletB [ValidateNotNullOrEmpty] public string BootstrapVersion { get; set; } + [Parameter( + ValueFromPipelineByPropertyName = true, + HelpMessage = "Uninstall Chef client during update/uninstall extension. Default is false.")] + [ValidateNotNullOrEmpty] + public SwitchParameter UninstallChefClient { get; set; } + [Parameter( Mandatory = true, ParameterSetName = LinuxParameterSetName, @@ -174,6 +180,7 @@ private void SetPublicConfig() string AutoUpdateChefClient = this.AutoUpdateChefClient.IsPresent ? "true" : "false"; string DeleteChefConfig = this.DeleteChefConfig.IsPresent ? "true" : "false"; string BootstrapVersion = this.BootstrapVersion; + string UninstallChefClient = this.UninstallChefClient.IsPresent ? "true" : "false"; //Cases handled: // 1. When clientRb given by user and: @@ -227,42 +234,46 @@ private void SetPublicConfig() { if (IsBootstrapOptionsEmpty) { - this.PublicConfiguration = string.Format("{{{0},{1},{2},{3}}}", + this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4}}}", string.Format(AutoUpdateTemplate, AutoUpdateChefClient), string.Format(DeleteChefConfigTemplate, DeleteChefConfig), string.Format(ClientRbTemplate, ClientConfig), - string.Format(BootstrapVersionTemplate, BootstrapVersion)); + string.Format(BootstrapVersionTemplate, BootstrapVersion), + string.Format(UninstallChefClientTemplate, UninstallChefClient)); } else { - this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4}}}", + this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5}}}", string.Format(AutoUpdateTemplate, AutoUpdateChefClient), string.Format(DeleteChefConfigTemplate, DeleteChefConfig), string.Format(ClientRbTemplate, ClientConfig), string.Format(BootStrapOptionsTemplate, this.BootstrapOptions), - string.Format(BootstrapVersionTemplate, BootstrapVersion)); + string.Format(BootstrapVersionTemplate, BootstrapVersion), + string.Format(UninstallChefClientTemplate, UninstallChefClient)); } } else { if (IsBootstrapOptionsEmpty) { - this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4}}}", + this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5}}}", string.Format(AutoUpdateTemplate, AutoUpdateChefClient), string.Format(DeleteChefConfigTemplate, DeleteChefConfig), string.Format(ClientRbTemplate, ClientConfig), string.Format(RunListTemplate, this.RunList), - string.Format(BootstrapVersionTemplate, BootstrapVersion)); + string.Format(BootstrapVersionTemplate, BootstrapVersion), + string.Format(UninstallChefClientTemplate, UninstallChefClient)); } else { - this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5}}}", + this.PublicConfiguration = string.Format("{{{0},{1},{2},{3},{4},{5},{6}}}", string.Format(AutoUpdateTemplate, AutoUpdateChefClient), string.Format(DeleteChefConfigTemplate, DeleteChefConfig), string.Format(ClientRbTemplate, ClientConfig), string.Format(RunListTemplate, this.RunList), string.Format(BootStrapOptionsTemplate, this.BootstrapOptions), - string.Format(BootstrapVersionTemplate, BootstrapVersion)); + string.Format(BootstrapVersionTemplate, BootstrapVersion), + string.Format(UninstallChefClientTemplate, UninstallChefClient)); } } } 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 2b74f5e681b7..4f293890a4d5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs @@ -26,6 +26,7 @@ public class VirtualMachineChefExtensionCmdletBase : VirtualMachineExtensionCmdl protected const string DeleteChefConfigTemplate = "\"deleteChefConfig\":\"{0}\""; protected const string ClientRbTemplate = "\"client_rb\":\"{0}\""; protected const string BootstrapVersionTemplate = "\"bootstrap_version\":\"{0}\""; + protected const string UninstallChefClientTemplate = "\"uninstallChefClient\":\"{0}\""; protected const string BootStrapOptionsTemplate = "\"bootstrap_options\":{0}"; protected const string RunListTemplate = "\"runlist\": \"\\\"{0}\\\"\""; 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 932c942e61d4..7b825aeae659 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 @@ -35131,6 +35131,12 @@ If this parameter is not specified, the default value is Standard_GRS. Specifies the version of chef-client to be installed with the extension. + + UninstallChefClient + + Indicates that this cmdlet uninstalls the Chef Client on the vitual machine. + + OrganizationName @@ -35226,6 +35232,12 @@ If this parameter is not specified, the default value is Standard_GRS. Specifies the version of chef-client to be installed with the extension. + + UninstallChefClient + + Indicates that this cmdlet uninstalls the Chef Client on the vitual machine. + + OrganizationName @@ -35354,6 +35366,18 @@ If this parameter is not specified, the default value is Standard_GRS. none + + UninstallChefClient + + Indicates that this cmdlet uninstalls the Chef Client on the vitual machine. + + SwitchParameter + + SwitchParameter + + + none + Linux