Skip to content

Commit

Permalink
Allow creating more than one config file per integration (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvaka authored Dec 9, 2020
1 parent e845178 commit 204c592
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions manifests/integration.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
Optional[Hash] $init_config = undef,
Optional[Array] $logs = undef,
String $integration = $title,
String $conf_file = 'conf',
Enum['present', 'absent'] $ensure = 'present',
){

include datadog_agent

if $::datadog_agent::_agent_major_version > 5 {
$dst = "${datadog_agent::params::conf_dir}/${integration}.d/conf.yaml"
file { "${datadog_agent::params::conf_dir}/${integration}.d":
ensure => directory,
owner => $datadog_agent::dd_user,
group => $datadog_agent::dd_group,
mode => $datadog_agent::params::permissions_directory,
before => File[$dst]
$dst_dir = "${datadog_agent::params::conf_dir}/${integration}.d"
$dst = "${dst_dir}/${$conf_file}.yaml"
if (! defined(File[$dst_dir])) {
file { $dst_dir:
ensure => directory,
owner => $datadog_agent::dd_user,
group => $datadog_agent::dd_group,
mode => $datadog_agent::params::permissions_directory,
before => File[$dst]
}
}
} else {
$dst = "${datadog_agent::params::legacy_conf_dir}/${integration}.yaml"
Expand Down

0 comments on commit 204c592

Please sign in to comment.