Add support for agent 7
MODIFY
attributes/default.rb
attributes/default.rb
@@ -29,20 +29,13 @@ default['datadog']['api_key'] = nil
default['datadog']['application_key'] = nil
# If you're installing a pre-release version of Agent 6 (beta or RC), you need to:
-# * on debian: set node['datadog']['agent6_aptrepo_dist'] to 'beta' instead of 'stable'
-# * on RHEL: set node['datadog']['agent6_yumrepo'] to 'https://yum.datadoghq.com/beta/x86_64/'
+# * on debian: set node['datadog']['aptrepo_dist'] to 'beta' instead of 'stable'
+# * on RHEL: set node['datadog']['yumrepo'] to 'https://yum.datadoghq.com/beta/x86_64/'
default['datadog']['agent_major_version'] = 6
########################################################################
### Agent 6/7 only attributes ###
-# repos where datadog-agent v6 packages are available
-default['datadog']['agent6_aptrepo'] = 'http://apt.datadoghq.com'
-default['datadog']['agent6_aptrepo_dist'] = 'stable'
-# RPMs are only available for RHEL >= 6 (-> use https protocol) and x86_64 arch
-default['datadog']['agent6_yumrepo'] = 'https://yum.datadoghq.com/stable/6/x86_64/'
-default['datadog']['agent6_yumrepo_suse'] = 'https://yum.datadoghq.com/suse/stable/6/x86_64/'
-
# The site of the Datadog intake to send Agent data to.
# This configuration option is supported since Agent 6.6
# Defaults to 'datadoghq.com', set to 'datadoghq.eu' to send data to the EU site.
@@ -133,17 +126,21 @@ yum_protocol =
'https'
end
+# repos where datadog-agent packages are available
+default['datadog']['aptrepo'] = 'http://apt.datadoghq.com'
+default['datadog']['aptrepo_dist'] = 'stable'
+default['datadog']['yumrepo'] = 'https://yum.datadoghq.com/stable/'
+default['datadog']['yumrepo_suse'] = 'https://yum.datadoghq.com/suse/stable/'
+default['datadog']['agent5_yumrepo'] = "#{yum_protocol}://yum.datadoghq.com/rpm/#{architecture_map[node['kernel']['machine']]}/"
+default['datadog']['agent5_yumrepo_suse'] = "https://yum.datadoghq.com/suse/rpm/#{architecture_map[node['kernel']['machine']]}/"
+
# NB: if you're not using the default repos and/or distributions, make sure
# to pin the version you're installing with node['datadog']['agent_version']
default['datadog']['installrepo'] = true
-default['datadog']['agent5_aptrepo'] = 'http://apt.datadoghq.com'
-default['datadog']['agent5_aptrepo_dist'] = 'stable'
default['datadog']['aptrepo_retries'] = 4
default['datadog']['aptrepo_use_backup_keyserver'] = false
default['datadog']['aptrepo_keyserver'] = 'hkp://keyserver.ubuntu.com:80'
default['datadog']['aptrepo_backup_keyserver'] = 'hkp://pool.sks-keyservers.net:80'
-default['datadog']['agent5_yumrepo'] = "#{yum_protocol}://yum.datadoghq.com/rpm/#{architecture_map[node['kernel']['machine']]}/"
-default['datadog']['agent5_yumrepo_suse'] = "https://yum.datadoghq.com/suse/rpm/#{architecture_map[node['kernel']['machine']]}/"
default['datadog']['yumrepo_gpgkey'] = "#{yum_protocol}://yum.datadoghq.com/DATADOG_RPM_KEY.public"
default['datadog']['yumrepo_proxy'] = nil
default['datadog']['yumrepo_proxy_username'] = nil

MODIFY
kitchen.yml
kitchen.yml
@@ -77,10 +77,10 @@ suites:
- recipe[datadog::dd-agent]
attributes:
datadog: &DATADOG
- agent6_aptrepo: 'http://apt.datad0g.com'
- agent6_aptrepo_dist: 'beta'
+ aptrepo: 'http://apt.datad0g.com'
+ aptrepo_dist: 'beta'
# agent_version: '1:6.11.3~rc.2-1'
- agent6_package_action: 'install'
+ agent_package_action: 'install'
agent_allow_downgrade: true
api_key: somenonnullapikeythats32charlong
application_key: alsonotnil

MODIFY
recipes/repository.rb
recipes/repository.rb
@@ -27,13 +27,11 @@ when 'debian'
end
case node['datadog']['agent_major_version'].to_i
+ when 7
+ components = ['main', '7']
when 6
- uri = node['datadog']['agent6_aptrepo']
- distribution = node['datadog']['agent6_aptrepo_dist']
components = ['main', '6']
when 5
- uri = node['datadog']['agent5_aptrepo']
- distribution = node['datadog']['agent5_aptrepo_dist']
components = ['main']
else
Chef::Log.error('agent_major_version not supported.')
@@ -45,8 +43,8 @@ when 'debian'
apt_repository 'datadog' do
keyserver keyserver
key 'A2923DFF56EDA6E76E55E492D3A80E30382E94DE'
- uri uri
- distribution distribution
+ uri node['datadog']['aptrepo']
+ distribution node['datadog']['aptrepo_dist']
components components
action :add
retries retries
@@ -82,8 +80,8 @@ when 'rhel', 'fedora', 'amazon'
end
case node['datadog']['agent_major_version'].to_i
- when 6
- baseurl = node['datadog']['agent6_yumrepo']
+ when 6, 7
+ baseurl = URI::join(node['datadog']['yumrepo'], node['datadog']['agent_major_version'].to_s, 'x86_64').to_s
when 5
baseurl = node['datadog']['agent5_yumrepo']
else
@@ -137,8 +135,8 @@ when 'suse'
end
case node['datadog']['agent_major_version'].to_i
- when 6
- baseurl = node['datadog']['agent6_yumrepo_suse']
+ when 6, 7
+ baseurl = URI::join(node['datadog']['yumrepo_suse'], node['datadog']['agent_major_version'].to_s, 'x86_64').to_s
when 5
baseurl = node['datadog']['agent5_yumrepo_suse']
else

Add support for agent 7