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 14d943907165..246196cfa6f9 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 AutoUpdateClient { get; set; }
+ public SwitchParameter AutoUpdateChefClient { get; set; }
[Parameter(
Mandatory = true,
@@ -108,9 +108,12 @@ internal void ExecuteCommand()
private string GetLatestChefExtensionVersion()
{
var extensionList = this.ComputeClient.VirtualMachineExtensions.List();
- return extensionList.ResourceExtensions.Where(
+ var version = extensionList.ResourceExtensions.Where(
extension => extension.Publisher == ExtensionDefaultPublisher
&& extension.Name == base.extensionName).Max(extension => extension.Version);
+ string[] separators = {"."};
+ string majorVersion = version.Split(separators, StringSplitOptions.None)[0];
+ return majorVersion + ".*";
}
private void SetDefault()
@@ -147,7 +150,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";
+ string AutoUpdateChefClient = this.AutoUpdateChefClient.IsPresent ? "true" : "false";
//Cases handled:
// 1. When clientRb given by user and:
@@ -200,13 +203,13 @@ private void SetPublicConfig()
if (IsRunListEmpty)
{
this.PublicConfiguration = string.Format("{{{0},{1}}}",
- string.Format(AutoUpdateTemplate, AutoUpdateClient),
+ string.Format(AutoUpdateTemplate, AutoUpdateChefClient),
string.Format(ClientRbTemplate, ClientConfig));
}
else
{
this.PublicConfiguration = string.Format("{{{0},{1},{2}}}",
- string.Format(AutoUpdateTemplate, AutoUpdateClient),
+ string.Format(AutoUpdateTemplate, AutoUpdateChefClient),
string.Format(ClientRbTemplate, ClientConfig),
string.Format(RunListTemplate, this.RunList));
}
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 8ced59a69e57..c14640929f68 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
- AutoUpdateClient
+ AutoUpdateChefClient
Flag to opt for auto chef-client update. Chef-client update is false by default.