Skip to content
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

Add attributes for package download retries options #390

Merged
merged 1 commit into from
Jan 11, 2017
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
5 changes: 5 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
# Allow override with `upgrade` to get latest (Linux only)
default['datadog']['agent_package_action'] = 'install'

# Agent package options
# retries and retry_delay for package download/install
default['datadog']['agent_package_retries'] = nil
default['datadog']['agent_package_retry_delay'] = nil

# Allow downgrades of the agent (Linux only)
# Note: on apt-based platforms, this will use the `--force-yes` option on the apt-get command. Use with caution.
default['datadog']['agent_allow_downgrade'] = false
Expand Down
6 changes: 6 additions & 0 deletions recipes/_install-linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,23 @@
only_if 'rpm -q datadog-agent-base' if %w(rhel fedora).include?(node['platform_family'])
not_if 'apt-cache policy datadog-agent-base | grep "Installed: (none)"' if node['platform_family'] == 'debian'
end
package_retries = node['datadog']['agent_package_retries']
package_retry_delay = node['datadog']['agent_package_retry_delay']
# Install the regular package
case node['platform_family']
when 'debian'
apt_package 'datadog-agent' do
version dd_agent_version
retries package_retries unless package_retries.nil?
retry_delay package_retry_delay unless package_retry_delay.nil?
action node['datadog']['agent_package_action'] # default is :install
options '--force-yes' if node['datadog']['agent_allow_downgrade']
end
when 'rhel', 'fedora'
yum_package 'datadog-agent' do
version dd_agent_version
retries package_retries unless package_retries.nil?
retry_delay package_retry_delay unless package_retry_delay.nil?
action node['datadog']['agent_package_action'] # default is :install
allow_downgrade node['datadog']['agent_allow_downgrade']
end
Expand Down
5 changes: 5 additions & 0 deletions recipes/_install-windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@
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')

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
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
Expand Down