From ed4320e053d72fcf6de13650536a9e227703bc2d Mon Sep 17 00:00:00 2001 From: Justinas <12399634+justinas-b@users.noreply.github.com> Date: Wed, 3 Apr 2019 12:30:37 +0300 Subject: [PATCH 1/2] Adding support for Amazon Linux 2 --- attributes/default.rb | 5 +++-- metadata.rb | 4 +++- resources/install.rb | 21 ++++++++++++++------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 8c24ff0..5020889 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -14,7 +14,8 @@ # platform_family keyed download sha256 checksums default['influxdb']['shasums'] = { 'debian' => '88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037', - 'rhel' => '5efa2e4060e75a07ad1a3abd094322c708131c73be575e0ffe41817b788ff44a' + 'rhel' => '5efa2e4060e75a07ad1a3abd094322c708131c73be575e0ffe41817b788ff44a', + 'amazon' => '5efa2e4060e75a07ad1a3abd094322c708131c73be575e0ffe41817b788ff44a' } # Grab clients -- right now only supports Ruby and CLI @@ -131,7 +132,7 @@ } case node['platform_family'] -when 'rhel', 'fedora' +when 'rhel', 'fedora', 'amazon' default['influxdb']['upstream_repository'] = case node['platform'] when 'centos' "https://repos.influxdata.com/centos/#{node['platform_version'].to_i}/$basearch/stable" diff --git a/metadata.rb b/metadata.rb index 74291b9..4e0984b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,12 +5,14 @@ maintainer_email 'me@bdang.it' license 'MIT' description 'InfluxDB, a timeseries database' -version '6.3.1' +version '6.3.2' supports 'centos' supports 'debian' supports 'redhat' supports 'ubuntu' +supports 'amazon' + # For CLI client # https://github.com/redguide/nodejs diff --git a/resources/install.rb b/resources/install.rb index 5e4b560..c45ebce 100644 --- a/resources/install.rb +++ b/resources/install.rb @@ -19,14 +19,16 @@ action :install do case new_resource.install_type when 'package' - if platform_family? 'rhel' + + case node['platform_family'] + when 'rhel', 'amazon' yum_repository 'influxdb' do - description 'InfluxDB Repository - RHEL \$releasever' + description 'InfluxDB Repository - \$releasever' baseurl node['influxdb']['upstream_repository'] gpgkey new_resource.influxdb_key only_if { new_resource.include_repository } end - elsif platform_family? 'debian' + when 'debian' # see if we should auto detect unless new_resource.arch_type new_resource.arch_type determine_arch_type(new_resource, node) @@ -54,8 +56,10 @@ options '--force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' if platform_family? 'debian' end when 'file' - if platform_family? 'rhel' + case node['platform_family'] + when 'rhel', 'amazon' file_name = "#{new_resource.package_name}-#{new_resource.install_version}.x86_64.rpm" + remote_file "#{Chef::Config[:file_cache_path]}/#{file_name}" do source "#{node['influxdb']['download_urls']['rhel']}/#{file_name}" checksum new_resource.checksum @@ -66,9 +70,11 @@ source "#{Chef::Config[:file_cache_path]}/#{file_name}" action :install end - elsif platform_family? 'debian' + + when 'debian' # NOTE: file_name would be influxdb_ instead. file_name = "#{new_resource.package_name}_#{new_resource.install_version}_amd64.deb" + remote_file "#{Chef::Config[:file_cache_path]}/#{file_name}" do source "#{node['influxdb']['download_urls']['debian']}/#{file_name}" checksum new_resource.checksum @@ -90,12 +96,13 @@ # rubocop:enable Metrics/BlockLength action :remove do - if platform_family? 'rhel' + case node['platform_family'] + when 'rhel', 'amazon' yum_repository 'influxdb' do action :delete only_if { new_resource.include_repository } end - elsif platform_family? 'debian' + when 'debian' apt_repository 'influxdb' do action :remove only_if { new_resource.include_repository } From 9470f29929c765139e7c4279831a0ab7943549e3 Mon Sep 17 00:00:00 2001 From: justinas-b <12399634+justinas-b@users.noreply.github.com> Date: Sat, 6 Apr 2019 14:34:42 +0300 Subject: [PATCH 2/2] Removing extra line in metadata.rb --- metadata.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 4e0984b..4ab7218 100644 --- a/metadata.rb +++ b/metadata.rb @@ -13,7 +13,6 @@ supports 'ubuntu' supports 'amazon' - # For CLI client # https://github.com/redguide/nodejs depends 'nodejs', '>= 2.4.4'