Skip to content

[Set-AzureVMChefExtension cmdlets] Add AutoUpdateClient option to SetAzureVMChefExtension cmdlets #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2014
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 @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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));
}
}

Expand All @@ -223,4 +232,4 @@ protected override void ProcessRecord()
ExecuteCommand();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}\\\"\"";

Expand All @@ -44,4 +45,4 @@ protected string GetPlatformSpecificExtensionName()
else { return null; }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32701,6 +32701,17 @@ PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "Con
</dev:type>
<dev:defaultValue></dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" position="named">
<maml:name>AutoUpdateClient</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>
<dev:type>
<maml:name>Boolean</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>false</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="false" globbing="false" position="named">
<maml:name>Linux</maml:name>
<maml:description>
Expand Down