From b37569de137f76211a560902ff67a7ab0475cabb Mon Sep 17 00:00:00 2001 From: "Ian C. Ward" Date: Thu, 9 Jun 2016 15:19:03 -0400 Subject: [PATCH 1/2] Fixed #311 - Make yum gpgkey an attribute --- attributes/default.rb | 4 ++++ recipes/repository.rb | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 2ac304df..7d678c70 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -62,10 +62,14 @@ } architecture_map.default = 'x86_64' +# Older versions of yum embed M2Crypto with SSL that doesn't support TLS1.2 +prefix = node['platform_version'].to_i < 6 ? 'http' : 'https' + default['datadog']['installrepo'] = true default['datadog']['aptrepo'] = 'http://apt.datadoghq.com' default['datadog']['aptrepo_dist'] = 'stable' default['datadog']['yumrepo'] = "http://yum.datadoghq.com/rpm/#{architecture_map[node['kernel']['machine']]}/" +default['datadog']['yumrepo_gpgkey'] = "#{prefix}://yum.datadoghq.com/DATADOG_RPM_KEY.public" default['datadog']['yumrepo_proxy'] = nil default['datadog']['yumrepo_proxy_username'] = nil default['datadog']['yumrepo_proxy_password'] = nil diff --git a/recipes/repository.rb b/recipes/repository.rb index 88a36731..1d578fcf 100644 --- a/recipes/repository.rb +++ b/recipes/repository.rb @@ -44,9 +44,7 @@ proxy node['datadog']['yumrepo_proxy'] proxy_username node['datadog']['yumrepo_proxy_username'] proxy_password node['datadog']['yumrepo_proxy_password'] - # Older versions of yum embed M2Crypto with SSL that doesn't support TLS1.2 - prefix = node['platform_version'].to_i < 6 ? 'http' : 'https' - gpgkey "#{prefix}://yum.datadoghq.com/DATADOG_RPM_KEY.public" + gpgkey node['datadog']['yumrepo_gpgkey'] action :add end end From 6eb91d71128de21662e83f7677b499625cf15a9e Mon Sep 17 00:00:00 2001 From: "Ian C. Ward" Date: Fri, 15 Jul 2016 15:39:37 -0400 Subject: [PATCH 2/2] Updating yumrepo_gpgkey based on feedback to GH-326 --- attributes/default.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 7d678c70..165e9fc3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -63,13 +63,18 @@ architecture_map.default = 'x86_64' # Older versions of yum embed M2Crypto with SSL that doesn't support TLS1.2 -prefix = node['platform_version'].to_i < 6 ? 'http' : 'https' +yum_protocol = + if node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6 + 'http' + else + 'https' + end default['datadog']['installrepo'] = true default['datadog']['aptrepo'] = 'http://apt.datadoghq.com' default['datadog']['aptrepo_dist'] = 'stable' default['datadog']['yumrepo'] = "http://yum.datadoghq.com/rpm/#{architecture_map[node['kernel']['machine']]}/" -default['datadog']['yumrepo_gpgkey'] = "#{prefix}://yum.datadoghq.com/DATADOG_RPM_KEY.public" +default['datadog']['yumrepo_gpgkey'] = "#{yum_protocol}://yum.datadoghq.com/DATADOG_RPM_KEY.public" default['datadog']['yumrepo_proxy'] = nil default['datadog']['yumrepo_proxy_username'] = nil default['datadog']['yumrepo_proxy_password'] = nil