From d43920caec4f17638294aff97f415c5ef0bc9727 Mon Sep 17 00:00:00 2001 From: siddheshwar-more Date: Fri, 5 Dec 2014 10:02:06 +0000 Subject: [PATCH 1/3] AutoUpdateClient option added to set-azurevmchefextension cmdlet --- .../Chef/SetAzureVMChefExtension.cs | 19 ++++++++++++++----- .../VirtualMachineChefExtensionCmdletBase.cs | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) 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..1b87e85af920 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 EnableAutoUpdateClient { 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.EnableAutoUpdateClient.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 +} From 0b5eee9104ed37dacc8831de1ef9d0b1d4391f15 Mon Sep 17 00:00:00 2001 From: siddheshwar-more Date: Fri, 5 Dec 2014 11:09:17 +0000 Subject: [PATCH 2/3] help file updated --- ...ndowsAzure.Commands.ServiceManagement.dll-Help.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) 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..f79cc3b15720 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 + + EnableAutoUpdateClient + + Flag to opt for auto chef-client update. Chef-client update is false by default. + + + Boolean + + + false + Linux From 332aad7b0da57f085ef2eacb207bec9630faf696 Mon Sep 17 00:00:00 2001 From: siddheshwar-more Date: Fri, 5 Dec 2014 11:27:13 +0000 Subject: [PATCH 3/3] Rename EnableAutoUpdateClient to AutoUpdateclient --- .../IaaS/Extensions/Chef/SetAzureVMChefExtension.cs | 4 ++-- ...osoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 1b87e85af920..14d943907165 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs @@ -80,7 +80,7 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineChefExtensionCmdletB ValueFromPipelineByPropertyName = true, HelpMessage = "Flag to opt for auto chef-client update. Chef-client update is false by default.")] [ValidateNotNullOrEmpty] - public SwitchParameter EnableAutoUpdateClient { get; set; } + public SwitchParameter AutoUpdateClient { get; set; } [Parameter( Mandatory = true, @@ -147,7 +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.EnableAutoUpdateClient.IsPresent ? "true" : "false"; + string AutoUpdateClient = this.AutoUpdateClient.IsPresent ? "true" : "false"; //Cases handled: // 1. When clientRb given by user and: 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 f79cc3b15720..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 @@ -32702,7 +32702,7 @@ PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "Con - EnableAutoUpdateClient + AutoUpdateClient Flag to opt for auto chef-client update. Chef-client update is false by default.