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

Fix Toml module #39

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# version of telegraf to install, e.g. '0.10.0-1' or nil for the latest
default['telegraf']['version'] = nil
default['telegraf']['toml_gem_version'] = '~> 0.1.2'
default['telegraf']['rubysource'] = 'https://rubygems.org'
default['telegraf']['config_file_path'] = '/etc/telegraf/telegraf.conf'
default['telegraf']['config'] = {
Expand Down
8 changes: 1 addition & 7 deletions resources/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
default_action :create

action :create do
chef_gem 'toml-rb' do
source node['telegraf']['rubysource']
clear_sources true
version '~> 0.3.0'
compile_time true if respond_to?(:compile_time)
end

require 'toml'

Expand All @@ -43,7 +37,7 @@
end

file path do
content TOML.dump(config)
content TOML::Generator.new(config).body
user 'root'
group 'telegraf'
mode '0644'
Expand Down
9 changes: 1 addition & 8 deletions resources/inputs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@
action :create
end

chef_gem 'toml-rb' do
source node['telegraf']['rubysource']
clear_sources true
version '~> 0.3.0'
compile_time true if respond_to?(:compile_time)
end

require 'toml'

service "telegraf_#{new_resource.service_name}" do
Expand All @@ -50,7 +43,7 @@
end

file "#{path}/#{name}_inputs.conf" do
content TOML.dump('inputs' => inputs)
content TOML::Generator.new('inputs' => inputs).body
user 'root'
group 'telegraf'
mode new_resource.rootonly ? '0640' : '0644'
Expand Down
4 changes: 4 additions & 0 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
default_action :create

action :create do
chef_gem 'toml' do
version node['telegraf']['toml_gem_version']
end

case install_type
when 'package'
if platform_family? 'rhel'
Expand Down
9 changes: 1 addition & 8 deletions resources/outputs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@
action :create
end

chef_gem 'toml-rb' do
source node['telegraf']['rubysource']
clear_sources true
version '~> 0.3.0'
compile_time true if respond_to?(:compile_time)
end

require 'toml'

service "telegraf_#{new_resource.service_name}" do
Expand All @@ -50,7 +43,7 @@
end

file "#{path}/#{name}_outputs.conf" do
content TOML.dump('outputs' => outputs)
content TOML::Generator.new('outputs' => outputs).body
user 'root'
group 'telegraf'
mode new_resource.rootonly ? '0640' : '0644'
Expand Down