Skip to content

Commit 8c98127

Browse files
authored
Add third-party integrations support (#643)
1 parent da2bf8e commit 8c98127

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ datadog_agent::install_integration { "mongo-1.9":
107107
ensure => present,
108108
integration_name => 'datadog-mongo',
109109
version => '1.9.0',
110+
third_party => false,
110111
}
111112
```
112113

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

119+
To install a third-party integration set the `third_party` parameter to `true`.
120+
118121
### Reporting
119122

120123
Ensure the [dogapi][3] gem is available on your system.

manifests/install_integration.pp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22
Enum['present', 'absent'] $ensure = 'present',
33
String $integration_name = undef,
44
String $version = undef,
5+
Boolean $third_party = false,
56
){
67

78
include datadog_agent
89

910
if $ensure == 'present' {
11+
12+
if $third_party {
13+
$install_cmd = 'install --third-party'
14+
} else {
15+
$install_cmd = 'install'
16+
}
17+
1018
exec { "install ${integration_name}==${version}":
11-
command => "${datadog_agent::params::agent_binary} integration install ${integration_name}==${version}",
19+
command => "${datadog_agent::params::agent_binary} integration ${install_cmd} ${integration_name}==${version}",
1220
user => $datadog_agent::dd_user,
1321
unless => "${datadog_agent::params::agent_binary} integration freeze | grep ${integration_name}==${version}",
1422
require => Package[$datadog_agent::params::package_name],

spec/defines/datadog_agent__install_integration_spec.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
let(:agent_binary) { '/opt/datadog-agent/bin/agent/agent' }
1818
end
1919

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

35+
describe 'installing a third-party integration' do
36+
let(:pre_condition) { "class {'::datadog_agent': }" }
37+
let(:title) { 'test' }
38+
let(:params) do
39+
{
40+
integration_name: 'datadog-aqua',
41+
version: '1.0.0',
42+
third_party: true,
43+
}
44+
end
45+
46+
it { is_expected.to compile }
47+
48+
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") }
49+
end
50+
3551
describe 'removing an integration' do
3652
let(:pre_condition) { "class {'::datadog_agent': }" }
3753
let(:title) { 'test' }

0 commit comments

Comments
 (0)