From 7110ce66775d23afb70a4bb048cdd88657074fb6 Mon Sep 17 00:00:00 2001 From: Oleg Khoruzhenko Date: Wed, 23 Jan 2019 15:38:52 -0600 Subject: [PATCH] Custom integration defined type bugfix --- manifests/integration.pp | 7 +++++++ spec/defines/datadog_agent__integration_spec.rb | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/manifests/integration.pp b/manifests/integration.pp index a8a9d957..ad4df926 100644 --- a/manifests/integration.pp +++ b/manifests/integration.pp @@ -12,6 +12,13 @@ if !$::datadog_agent::agent5_enable { $dst = "${datadog_agent::conf6_dir}/${integration}.d/conf.yaml" + file { "${datadog_agent::conf6_dir}/${integration}.d": + ensure => directory, + owner => $datadog_agent::dd_user, + group => $datadog_agent::dd_group, + mode => '0755', + before => File[$dst] + } } else { $dst = "${datadog_agent::conf_dir}/${integration}.yaml" } diff --git a/spec/defines/datadog_agent__integration_spec.rb b/spec/defines/datadog_agent__integration_spec.rb index f2d9a9a9..f43ae0b7 100644 --- a/spec/defines/datadog_agent__integration_spec.rb +++ b/spec/defines/datadog_agent__integration_spec.rb @@ -8,7 +8,8 @@ if enabled let(:conf_file) { '/etc/dd-agent/conf.d/test.yaml' } else - let(:conf_file) { '/etc/datadog-agent/conf.d/test.d/conf.yaml' } + let(:conf_dir) { '/etc/datadog-agent/conf.d/test.d' } + let(:conf_file) { "#{conf_dir}/conf.yaml" } end let (:title) { "test" } @@ -23,7 +24,12 @@ { 'one' => "two" } ] }} + + it { should compile } + if enabled + it { should contain_file("#{conf_dir}").that_comes_before("File[#{conf_file}]") } + end it { should contain_file("#{conf_file}").with_content(/init_config: /) } gem_spec = Gem.loaded_specs['puppet'] if gem_spec.version >= Gem::Version.new('4.0.0')