Skip to content

Commit dcc57ea

Browse files
authored
Merge pull request #223 from DataDog/jaime/report_fixes
[reporting] make the gem provider configurable at the `datadog-agent` class level.
2 parents 5aeca00 + f81fd7f commit dcc57ea

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ that needs to be done.
6161

6262
__To support reporting, your Puppet master needs to have the [dogapi](https://github.com/DataDog/dogapi-rb) gem installed, to do that either run the puppet agent on your master with this configuration or install it manually with `gem`.__
6363
_Please note if on Puppet Enterprise or POSS (ie. >=3.7.0) there is a soft dependency for reporting on the `puppetserver_gem` module. Install with `puppet module install puppetlabs-puppetserver_gem` - installing manually with `gem` will *not* work._
64+
_Also note that we have made the gem provider configurable, so you can set it to `puppetserver_gem` (already set by default) if on PE/POSS (>=3.7.0) or `gem` if on older versions of puppet_
6465

6566
3. Include any other integrations you want the agent to use, e.g.
6667

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
$hiera_tags = false,
185185
$facts_to_tags = [],
186186
$puppet_run_reports = false,
187+
$puppet_gem_provider = 'puppetserver_gem',
187188
$puppetmaster_user = 'puppet',
188189
$non_local_traffic = false,
189190
$dogstreams = [],
@@ -238,6 +239,7 @@
238239
validate_array($dogstreams)
239240
validate_array($facts_to_tags)
240241
validate_bool($puppet_run_reports)
242+
validate_string($puppet_gem_provider)
241243
validate_string($puppetmaster_user)
242244
validate_bool($non_local_traffic)
243245
validate_bool($log_to_syslog)
@@ -340,6 +342,7 @@
340342
if $puppet_run_reports {
341343
class { 'datadog_agent::reports':
342344
api_key => $api_key,
345+
puppet_gem_provider => $puppet_gem_provider,
343346
puppetmaster_user => $puppetmaster_user,
344347
dogapi_version => $datadog_agent::params::dogapi_version,
345348
hostname_extraction_regex => $hostname_extraction_regex,

manifests/reports.pp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
#
1616
class datadog_agent::reports(
1717
$api_key,
18+
$puppet_gem_provider,
1819
$puppetmaster_user,
1920
$dogapi_version,
2021
$hostname_extraction_regex = nil
2122
) {
2223

2324
include datadog_agent::params
2425
$rubydev_package = $datadog_agent::params::rubydev_package
25-
$gemprovider = 'gem'
2626

2727
# check to make sure that you're not installing rubydev somewhere else
2828
if ! defined(Package[$rubydev_package]) {
@@ -50,7 +50,6 @@
5050

5151
package{'dogapi':
5252
ensure => $dogapi_version,
53-
provider => $gemprovider,
53+
provider => $puppet_gem_provider,
5454
}
55-
5655
}

spec/classes/datadog_agent_reports_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
api_key: 'notanapikey',
88
hostname_extraction_regex: nil,
99
puppetmaster_user: 'puppet',
10-
dogapi_version: 'installed'
10+
dogapi_version: 'installed',
11+
puppet_gem_provider: 'gem'
1112
}
1213
end
1314
ALL_OS.each do |operatingsystem|
@@ -59,7 +60,8 @@
5960
api_key: 'notanapikey',
6061
hostname_extraction_regex: nil,
6162
puppetmaster_user: 'puppet',
62-
dogapi_version: '1.2.2'
63+
dogapi_version: '1.2.2',
64+
puppet_gem_provider: 'gem'
6365
}
6466
end
6567
describe "datadog_agent class dogapi version override" do

spec/classes/datadog_agent_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
context 'all supported operating systems' do
2323
ALL_OS.each do |operatingsystem|
2424
describe "datadog_agent class common actions on #{operatingsystem}" do
25-
let(:params) { { puppet_run_reports: true } }
25+
let(:params) { { puppet_run_reports: true, puppet_gem_provider: 'gem' } }
2626
let(:facts) do
2727
{
2828
operatingsystem: operatingsystem,

0 commit comments

Comments
 (0)