diff --git a/README.md b/README.md index 106bcee7..655f2567 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/manifests/init.pp b/manifests/init.pp index f57675f2..d54776fd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 = [], @@ -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) @@ -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, diff --git a/manifests/reports.pp b/manifests/reports.pp index 7ffd20c9..375a6c5c 100644 --- a/manifests/reports.pp +++ b/manifests/reports.pp @@ -15,6 +15,7 @@ # class datadog_agent::reports( $api_key, + $puppet_gem_provider, $puppetmaster_user, $dogapi_version, $hostname_extraction_regex = nil @@ -22,7 +23,6 @@ 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]) { @@ -50,7 +50,6 @@ package{'dogapi': ensure => $dogapi_version, - provider => $gemprovider, + provider => $puppet_gem_provider, } - } diff --git a/spec/classes/datadog_agent_reports_spec.rb b/spec/classes/datadog_agent_reports_spec.rb index a5026ee3..8933687a 100644 --- a/spec/classes/datadog_agent_reports_spec.rb +++ b/spec/classes/datadog_agent_reports_spec.rb @@ -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| @@ -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 diff --git a/spec/classes/datadog_agent_spec.rb b/spec/classes/datadog_agent_spec.rb index 4ba66d15..47a35279 100644 --- a/spec/classes/datadog_agent_spec.rb +++ b/spec/classes/datadog_agent_spec.rb @@ -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,