-
Notifications
You must be signed in to change notification settings - Fork 260
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
[windows] Add option to support EXE Agent installer #410
Changes from 2 commits
1f6ecff
2c165ab
5916e36
b0ab190
0507f83
ebfcb89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,28 +25,48 @@ | |
end | ||
|
||
# If no version is specified, select the latest package | ||
dd_agent_msi = dd_agent_version ? "ddagent-cli-#{dd_agent_version}.msi" : 'ddagent-cli.msi' | ||
temp_file = ::File.join(Chef::Config[:file_cache_path], 'ddagent-cli.msi') | ||
dd_agent_installer_basename = dd_agent_version ? "ddagent-cli-#{dd_agent_version}" : 'ddagent-cli' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: let's not forget to follow this naming convention when uploading the new Windows packages. (default name is different) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at this point the default installer URL is not different for the MSI (and the EXE has the same URL, except that it has an In general though if we're concerned about the user experience of automatic upgrades failing when the default latest package is downloaded (shouldn't happen with this cookbook but could happen with user-maintained scripts) then we may consider using a different URL for the new installer. |
||
temp_file_basename = ::File.join(Chef::Config[:file_cache_path], 'ddagent-cli') | ||
|
||
if node['datadog']['windows_agent_use_exe'] | ||
dd_agent_installer = "#{dd_agent_installer_basename}.exe" | ||
temp_file = "#{temp_file_basename}.exe" | ||
installer_type = :custom | ||
install_options = '/q' | ||
else | ||
dd_agent_installer = "#{dd_agent_installer_basename}.msi" | ||
temp_file = "#{temp_file_basename}.msi" | ||
installer_type = :msi | ||
# Agent >= 5.12.0 installs per-machine by default, but specifying ALLUSERS=1 shouldn't affect the install | ||
install_options = '/norestart ALLUSERS=1' | ||
end | ||
|
||
# Use a separate resource without a `source` so that it looks in the Registry to find the MSI to use | ||
# for the package removal | ||
windows_package 'Datadog Agent removal' do | ||
package_name 'Datadog Agent' | ||
action :nothing | ||
end | ||
|
||
package_retries = node['datadog']['agent_package_retries'] | ||
package_retry_delay = node['datadog']['agent_package_retry_delay'] | ||
|
||
# Download the installer to a temp location | ||
remote_file temp_file do | ||
source node['datadog']['windows_agent_url'] + dd_agent_msi | ||
source node['datadog']['windows_agent_url'] + dd_agent_installer | ||
checksum node['datadog']['windows_agent_checksum'] if node['datadog']['windows_agent_checksum'] | ||
retries package_retries unless package_retries.nil? | ||
retry_delay package_retry_delay unless package_retry_delay.nil? | ||
# As of v1.37, the windows cookbook doesn't upgrade the package if a newer version is downloaded | ||
# As a workaround uninstall the package first if a new MSI is downloaded | ||
notifies :remove, 'windows_package[Datadog Agent]', :immediately | ||
notifies :remove, 'windows_package[Datadog Agent removal]', :immediately | ||
end | ||
|
||
# Install the package | ||
windows_package 'Datadog Agent' do # ~FC009 | ||
source temp_file | ||
installer_type :msi | ||
options '/norestart ALLUSERS=1' | ||
installer_type installer_type | ||
options install_options | ||
action :install | ||
success_codes [0, 3010] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'd say "all known use cases". That's pretty broad :)