Skip to content
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ datadog_agent::install_integration { "mongo-1.9":
ensure => present,
integration_name => 'datadog-mongo',
version => '1.9.0',
third_party => false,
}
```

Expand All @@ -115,6 +116,8 @@ datadog_agent::install_integration { "mongo-1.9":
- `present` (default)
- `absent` (removes a previously pinned version of an integration)

To install a third-party integration set the `third_party` parameter to `true`.

### Reporting

Ensure the [dogapi][3] gem is available on your system.
Expand Down
10 changes: 9 additions & 1 deletion manifests/install_integration.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
Enum['present', 'absent'] $ensure = 'present',
String $integration_name = undef,
String $version = undef,
Boolean $third_party = false,
){

include datadog_agent

if $ensure == 'present' {

if $third_party {
$install_cmd = 'install --third-party'
} else {
$install_cmd = 'install'
}

exec { "install ${integration_name}==${version}":
command => "${datadog_agent::params::agent_binary} integration install ${integration_name}==${version}",
command => "${datadog_agent::params::agent_binary} integration ${install_cmd} ${integration_name}==${version}",
user => $datadog_agent::dd_user,
unless => "${datadog_agent::params::agent_binary} integration freeze | grep ${integration_name}==${version}",
require => Package[$datadog_agent::params::package_name],
Expand Down
18 changes: 17 additions & 1 deletion spec/defines/datadog_agent__install_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
let(:agent_binary) { '/opt/datadog-agent/bin/agent/agent' }
end

describe 'installing an integration' do
describe 'installing a core integration' do
let(:pre_condition) { "class {'::datadog_agent': }" }
let(:title) { 'test' }
let(:params) do
Expand All @@ -32,6 +32,22 @@
it { is_expected.to contain_exec('install datadog-mongo==1.9.0').with_command("#{agent_binary} integration install datadog-mongo==1.9.0") }
end

describe 'installing a third-party integration' do
let(:pre_condition) { "class {'::datadog_agent': }" }
let(:title) { 'test' }
let(:params) do
{
integration_name: 'datadog-aqua',
version: '1.0.0',
third_party: true,
}
end

it { is_expected.to compile }

it { is_expected.to contain_exec('install datadog-aqua==1.0.0').with_command("#{agent_binary} integration install --third-party datadog-aqua==1.0.0") }
end

describe 'removing an integration' do
let(:pre_condition) { "class {'::datadog_agent': }" }
let(:title) { 'test' }
Expand Down