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

Adding support for Amazon Linux 2 #178

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 3 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
maintainer_email '[email protected]'
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'

bdangit marked this conversation as resolved.
Show resolved Hide resolved
# For CLI client
# https://github.com/redguide/nodejs
Expand Down
21 changes: 14 additions & 7 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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_<version> 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
Expand All @@ -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 }
Expand Down