Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32702,7 +32702,7 @@ PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "Con
<dev:defaultValue></dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" position="named">
<maml:name>AutoUpdateClient</maml:name>
<maml:name>AutoUpdateChefClient</maml:name>
<maml:description>
<maml:para>Flag to opt for auto chef-client update. Chef-client update is false by default.</maml:para>
</maml:description>
Expand Down