summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliasgar16 <aliasgar.batterywala@msystechnologies.com>2016-11-14 21:09:32 +0530
committeraliasgar16 <aliasgar.batterywala@msystechnologies.com>2016-12-09 19:40:29 +0530
commitce1a4f7a8a12d56a60321297b66b24f6404dcc64 (patch)
tree0f7fb7bcfdf287f6d19eb7d1eb3b2b6fb4a436c5
parentef18311bdfe53eb87460c3638f7571131b10d96d (diff)
downloadchef-ce1a4f7a8a12d56a60321297b66b24f6404dcc64.tar.gz
Added support in WIX to install chef-client as a scheduled task.
Signed-off-by: aliasgar16 <aliasgar.batterywala@msystechnologies.com>
-rw-r--r--omnibus/resources/chef/msi/localization-en-us.wxl.erb4
-rw-r--r--omnibus/resources/chef/msi/source.wxs.erb24
2 files changed, 26 insertions, 2 deletions
diff --git a/omnibus/resources/chef/msi/localization-en-us.wxl.erb b/omnibus/resources/chef/msi/localization-en-us.wxl.erb
index 62c27b99f6..00e9e254b2 100644
--- a/omnibus/resources/chef/msi/localization-en-us.wxl.erb
+++ b/omnibus/resources/chef/msi/localization-en-us.wxl.erb
@@ -16,11 +16,15 @@
<String Id="VerifyReadyDlgInstallTitle">{\WixUI_Font_Title_White}Ready to install [ProductName]</String>
+ <!-- Schedule Task -->
+ <String Id="SchTaskDisplayName"><%= friendly_name %> Schedule Task</String>
+ <String Id="SchTaskDescription">Schedule <%= friendly_name %> to run at a pre-defined time intervals.</String>
<!-- Service -->
<!-- Keep these in sync with the name and description in chef-service-manager -->
<String Id="ServiceDisplayName"><%= friendly_name %> Service</String>
<String Id="ServiceDescription">Runs <%= friendly_name %> on regular, configurable intervals.</String>
<String Id="FeatureMainName"><%= friendly_name %></String>
+ <String Id="FeatureSchTaskName"><%= friendly_name %> Schedule Task</String>
<String Id="FeatureServiceName"><%= friendly_name %> Service</String>
<String Id="FeaturePSModuleName"><%= friendly_name %> PowerShell wrappers</String>
diff --git a/omnibus/resources/chef/msi/source.wxs.erb b/omnibus/resources/chef/msi/source.wxs.erb
index bdde02687e..1db366e352 100644
--- a/omnibus/resources/chef/msi/source.wxs.erb
+++ b/omnibus/resources/chef/msi/source.wxs.erb
@@ -67,9 +67,19 @@
Impersonate="no"
Return="ignore" />
+ <CustomAction Id="CreateChefClientScheduledTask"
+ Directory="TARGETDIR"
+ ExeCommand="&quot;[SystemFolder]SCHTASKS.EXE&quot; /CREATE /TN &quot;ChefClientSchTask&quot; /SC &quot;MINUTE&quot; /MO &quot;20&quot; /F /TR &quot;&quot;cmd /c &quot;[RubyExecutable] [ChefClientPath]\chef-client -L [ChefClientLog]\chef-client.log -c [CONFIGLOCATION]\client.rb&quot;&quot;&quot; /RU &quot;temp_user&quot; /RP &quot;temp_password@123&quot; /RL &quot;HIGHEST&quot; /ST &quot;(Time.now + 60 * 30).strftime('%H:%M')&quot;"
+ Execute="deferred"
+ Impersonate="no"
+ Return="check" />
+
<InstallExecuteSequence>
<Custom Action="FastUnzip" After="InstallFiles">NOT Installed</Custom>
<Custom Action="Cleanup" After="RemoveFiles">REMOVE~="ALL"</Custom>
+ <Custom Action="CreateChefClientScheduledTask" After="InstallFiles">
+ <![CDATA[&ChefSchTaskFeature=3]]>
+ </Custom>
</InstallExecuteSequence>
<UI>
@@ -151,8 +161,18 @@
<ComponentRef Id="ChefPSModulePath" />
</Feature>
- <Feature Id="ChefServiceFeature" Title="!(loc.FeatureServiceName)" Level="1000" AllowAdvertise="no">
- <ComponentRef Id="ChefClientService" />
+ <Feature Id="ChefServiceOptions">
+ <Feature Id="ChefSchTaskFeature" Title="!(loc.FeatureSchTaskName)" Level="1000" AllowAdvertise="no">
+ <!--CustomAction will get executed and scheduled task for chef-client will get created-->
+ </Feature>
+
+ <Feature Id="ChefServiceFeature" Title="!(loc.FeatureServiceName)" Level="1000" AllowAdvertise="no">
+ <ComponentRef Id="ChefClientService" />
+ </Feature>
+
+ <Feature Id="None" Title="None" Level="1000" AllowAdvertise="no">
+ <!--Do Nothing-->
+ </Feature>
</Feature>
<!--