-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from majormoses/master
created a new resource to install:
- Loading branch information
Showing
7 changed files
with
114 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module InfluxdbCookbook | ||
# helper functions to be used in resources | ||
module Helpers | ||
def determine_arch_type(new_resource, node) | ||
if new_resource.arch_type | ||
new_resource.arch_type.to_s | ||
else | ||
case node['kernel']['machine'] | ||
when /64/ | ||
'amd64' | ||
when /386/ | ||
'i386' | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
maintainer_email '[email protected]' | ||
license 'MIT' | ||
description 'InfluxDB, a timeseries database' | ||
version '4.1.0' | ||
version '4.2.0' | ||
|
||
# For CLI client | ||
# https://github.com/redguide/nodejs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# resources/install.rb | ||
|
||
# Resource for InfluxDB install | ||
|
||
property :arch_type, kind_of: String | ||
property :include_repository, kind_of: [TrueClass, FalseClass], default: true | ||
property :influxdb_key, kind_of: String, default: 'https://repos.influxdata.com/influxdb.key' | ||
default_action :install | ||
|
||
include InfluxdbCookbook::Helpers | ||
|
||
action :install do | ||
if node.platform_family? 'rhel' | ||
yum_repository 'influxdb' do | ||
description 'InfluxDB Repository - RHEL \$releasever' | ||
baseurl node['influxdb']['upstream_repository'] | ||
gpgkey influxdb_key | ||
only_if { include_repository } | ||
end | ||
elsif node.platform_family? 'debian' | ||
# see if we should auto detect | ||
unless new_resource.arch_type | ||
new_resource.arch_type determine_arch_type(new_resource, node) | ||
end | ||
|
||
package 'apt-transport-https' do | ||
action :install | ||
end | ||
|
||
apt_repository 'influxdb' do | ||
uri node['influxdb']['upstream_repository'] | ||
distribution node['lsb']['codename'] | ||
components ['stable'] | ||
arch_type new_resource.arch_type | ||
key influxdb_key | ||
only_if { include_repository } | ||
end | ||
else | ||
Chef::Log.warn "I do not support your platform: #{node.platform_family}" | ||
end | ||
|
||
package 'influxdb' do | ||
version node['influxdb']['version'] | ||
end | ||
end | ||
|
||
action :remove do | ||
if node.platform_family? 'rhel' | ||
yum_repository 'influxdb' do | ||
action :delete | ||
only_if { include_repository } | ||
end | ||
elsif node.platform_family? 'debian' | ||
apt_repository 'influxdb' do | ||
action :delete | ||
only_if { include_repository } | ||
end | ||
else | ||
Chef.Log.warn "I do not support your platform: #{node.platform_family}" | ||
end | ||
|
||
package 'influxdb' do | ||
action :remove | ||
end | ||
end |