Skip to content

Commit e997cec

Browse files
committed
use to_toml instead of toml gem
1 parent 5de43c1 commit e997cec

File tree

10 files changed

+25
-52
lines changed

10 files changed

+25
-52
lines changed

.sync.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
---
2-
Gemfile:
3-
optional:
4-
':test':
5-
- gem: 'toml-rb'
6-
':system_tests':
7-
- gem: 'toml-rb'
82
spec/spec_helper.rb:
93
hiera_config: "'spec/hiera.yaml'"
104
.puppet-lint.rc:

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ group :test do
88
gem 'coveralls', :require => false
99
gem 'simplecov-console', :require => false
1010
gem 'puppet_metadata', '~> 3.0', :require => false
11-
gem 'toml-rb', :require => false
1211
end
1312

1413
group :development do
@@ -18,7 +17,6 @@ end
1817

1918
group :system_tests do
2019
gem 'voxpupuli-acceptance', '~> 2.0', :require => false
21-
gem 'toml-rb', :require => false
2220
end
2321

2422
group :release do

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This module has the following dependencies:
3333
for TLS-enabled repos in place. This can be achieved by installing the
3434
`apt-transport-https` package.
3535

36-
This module **requires** the [toml-rb](https://github.com/eMancu/toml-rb) gem. Either install the gem using puppet's native gem provider, [puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/puppetserver_gem), [pe_gem](https://forge.puppetlabs.com/puppetlabs/pe_gem), [pe_puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/pe_puppetserver_gem), or manually using one of the following methods:
36+
**Up to version v4.3.1** this module **requires** the [toml-rb](https://github.com/eMancu/toml-rb) gem. Either install the gem using puppet's native gem provider, [puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/puppetserver_gem), [pe_gem](https://forge.puppetlabs.com/puppetlabs/pe_gem), [pe_puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/pe_puppetserver_gem), or manually using one of the following methods:
3737
```
3838
# apply or puppet-master
3939
gem install toml-rb
@@ -43,6 +43,8 @@ This module **requires** the [toml-rb](https://github.com/eMancu/toml-rb) gem. E
4343
/opt/puppet/bin/puppetserver gem install toml-rb
4444
```
4545

46+
The toml-rb gem got replaced with `to_toml` from puppetlabs/stdlib.
47+
4648
In addition, for Windows, the following dependencies must be met:
4749

4850
* Chocolatey installed

manifests/aggregator.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
file { "${telegraf::config_folder}/${name}.conf":
2121
ensure => $_ensure,
22-
content => inline_template("<%= require 'toml-rb'; TomlRB.dump({'aggregators'=>{'${plugin_type}'=>@options}}) %>"),
22+
content => to_toml({ 'aggregators'=> { $plugin_type=> $options } }),
2323
require => Class['telegraf::config'],
2424
notify => Class['telegraf::service'],
2525
}

manifests/config.pp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,25 @@
55
class telegraf::config inherits telegraf {
66
assert_private()
77

8+
$agent = {
9+
'hostname' => $telegraf::hostname,
10+
'omit_hostname' => $telegraf::omit_hostname,
11+
'interval' => $telegraf::interval,
12+
'round_interval' => $telegraf::round_interval,
13+
'metric_batch_size' => $telegraf::metric_batch_size,
14+
'metric_buffer_limit' => $telegraf::metric_buffer_limit,
15+
'collection_jitter' => $telegraf::collection_jitter,
16+
'flush_interval' => $telegraf::flush_interval,
17+
'flush_jitter' => $telegraf::flush_jitter,
18+
'precision' => $telegraf::precision,
19+
'logfile' => $telegraf::logfile,
20+
'debug' => $telegraf::debug,
21+
'quiet' => $telegraf::quiet,
22+
}
23+
$config = to_toml({ 'global_tags' => $telegraf::global_tags, 'agent' => $agent, 'outputs' => $telegraf::outputs, 'inputs' => $telegraf::inputs })
824
file { $telegraf::config_file:
925
ensure => $telegraf::ensure_file,
10-
content => template('telegraf/telegraf.conf.erb'),
26+
content => $config,
1127
owner => $telegraf::config_file_owner,
1228
group => $telegraf::config_file_group,
1329
mode => $telegraf::config_file_mode,

manifests/input.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
file { "${telegraf::config_folder}/${name}.conf":
2121
ensure => $_ensure,
22-
content => inline_template("<%= require 'toml-rb'; TomlRB.dump({'inputs'=>{'${plugin_type}'=>@options}}) %>"),
22+
content => to_toml({ 'inputs'=> { $plugin_type=> $options } }),
2323
require => Class['telegraf::config'],
2424
notify => Class['telegraf::service'],
2525
}

manifests/output.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
file { "${telegraf::config_folder}/${name}.conf":
2121
ensure => $_ensure,
22-
content => inline_template("<%= require 'toml-rb'; TomlRB.dump({'outputs'=>{'${plugin_type}'=>@options}}) %>"),
22+
content => to_toml({ 'outputs'=> { $plugin_type=> $options } }),
2323
require => Class['telegraf::config'],
2424
notify => Class['telegraf::service'],
2525
}

manifests/processor.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
file { "${telegraf::config_folder}/${name}.conf":
2222
ensure => $_ensure,
23-
content => inline_template("<%= require 'toml-rb'; TomlRB.dump({'processors'=>{'${plugin_type}'=>@options}}) %>"),
23+
content => to_toml({ 'processors'=> { $plugin_type=> $options } }),
2424
require => Class['telegraf::config'],
2525
notify => Class['telegraf::service'],
2626
}

spec/spec_helper_acceptance.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
require 'voxpupuli/acceptance/spec_helper_acceptance'
44

5-
configure_beaker do |host|
6-
on host, '/opt/puppetlabs/puppet/bin/gem install toml-rb'
7-
end
5+
configure_beaker

templates/telegraf.conf.erb

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)