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

[reporting] make the gem provider configurable at the datadog-agent class level. #223

Merged
merged 3 commits into from
Aug 15, 2016
Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ that needs to be done.

__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`.__
_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._
_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_

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

Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
$hiera_tags = false,
$facts_to_tags = [],
$puppet_run_reports = false,
$puppet_gem_provider = 'puppetserver_gem',
$puppetmaster_user = 'puppet',
$non_local_traffic = false,
$dogstreams = [],
Expand Down Expand Up @@ -238,6 +239,7 @@
validate_array($dogstreams)
validate_array($facts_to_tags)
validate_bool($puppet_run_reports)
validate_string($puppet_gem_provider)
validate_string($puppetmaster_user)
validate_bool($non_local_traffic)
validate_bool($log_to_syslog)
Expand Down Expand Up @@ -340,6 +342,7 @@
if $puppet_run_reports {
class { 'datadog_agent::reports':
api_key => $api_key,
puppet_gem_provider => $puppet_gem_provider,
puppetmaster_user => $puppetmaster_user,
dogapi_version => $datadog_agent::params::dogapi_version,
hostname_extraction_regex => $hostname_extraction_regex,
Expand Down
5 changes: 2 additions & 3 deletions manifests/reports.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#
class datadog_agent::reports(
$api_key,
$puppet_gem_provider,
$puppetmaster_user,
$dogapi_version,
$hostname_extraction_regex = nil
) {

include datadog_agent::params
$rubydev_package = $datadog_agent::params::rubydev_package
$gemprovider = 'gem'

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

package{'dogapi':
ensure => $dogapi_version,
provider => $gemprovider,
provider => $puppet_gem_provider,
}

}
6 changes: 4 additions & 2 deletions spec/classes/datadog_agent_reports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
api_key: 'notanapikey',
hostname_extraction_regex: nil,
puppetmaster_user: 'puppet',
dogapi_version: 'installed'
dogapi_version: 'installed',
puppet_gem_provider: 'gem'
}
end
ALL_OS.each do |operatingsystem|
Expand Down Expand Up @@ -59,7 +60,8 @@
api_key: 'notanapikey',
hostname_extraction_regex: nil,
puppetmaster_user: 'puppet',
dogapi_version: '1.2.2'
dogapi_version: '1.2.2',
puppet_gem_provider: 'gem'
}
end
describe "datadog_agent class dogapi version override" do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/datadog_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
context 'all supported operating systems' do
ALL_OS.each do |operatingsystem|
describe "datadog_agent class common actions on #{operatingsystem}" do
let(:params) { { puppet_run_reports: true } }
let(:params) { { puppet_run_reports: true, puppet_gem_provider: 'gem' } }
let(:facts) do
{
operatingsystem: operatingsystem,
Expand Down