Skip to content

Commit

Permalink
Allow creating more than one config file per integration
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvaka committed Dec 4, 2020
1 parent e845178 commit f8a7032
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions manifests/integration.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
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 = "${datadog_agent::params::conf_dir}/${integration}.d/${$conf_file}.yaml"
if (! defined(File["${datadog_agent::params::conf_dir}/${integration}.d"])) {
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]
}
}
} else {
$dst = "${datadog_agent::params::legacy_conf_dir}/${integration}.yaml"
Expand Down

0 comments on commit f8a7032

Please sign in to comment.