Skip to content

Commit a39d0c8

Browse files
committed
Make linter happy
1 parent 8328e40 commit a39d0c8

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

manifests/integration.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
$dst = "${datadog_agent::params::legacy_conf_dir}/${integration}.yaml"
2222
}
2323

24+
$file_ensure = $ensure ? { default => file, 'absent' => absent }
25+
2426
file { $dst:
25-
ensure => $ensure ? { default => file, 'absent' => absent },
27+
ensure => $file_ensure,
2628
owner => $datadog_agent::dd_user,
2729
group => $datadog_agent::dd_group,
2830
mode => $datadog_agent::params::permissions_file,

spec/defines/datadog_agent__integration_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99

1010
if agent_major_version == 5
1111
let(:conf_file) { '/etc/dd-agent/conf.d/test.yaml' }
12+
1213
else
1314
let(:conf_dir) { "#{CONF_DIR}/test.d" }
1415
let(:conf_file) { "#{conf_dir}/conf.yaml" }
1516
end
1617

1718
gem_spec = Gem.loaded_specs['puppet']
1819

19-
if agent_major_version == 5
20+
if agent_major_version > 5
2021
it { is_expected.to contain_file(conf_dir.to_s).that_comes_before("File[#{conf_file}]") }
2122
end
2223
it { is_expected.to contain_file(conf_file.to_s).that_notifies("Service[#{SERVICE_NAME}]") }
@@ -31,12 +32,14 @@
3132
],
3233
}
3334
end
35+
3436
it { is_expected.to compile }
3537
if gem_spec.version >= Gem::Version.new('4.0.0')
3638
it { is_expected.to contain_file(conf_file.to_s).with_content(%r{---\ninit_config:\ninstances:\n- one: two\n}) }
3739
else
3840
it { is_expected.to contain_file(conf_file.to_s).with_content(%r{--- \n init_config:\n instances: \n - one: two}) }
3941
end
42+
it { is_expected.to contain_file(conf_file).with_ensure('file') }
4043
end
4144

4245
context 'with logs' do
@@ -50,12 +53,14 @@
5053
logs: ['one', 'two'],
5154
}
5255
end
56+
5357
it { is_expected.to compile }
5458
if gem_spec.version >= Gem::Version.new('4.0.0')
5559
it { is_expected.to contain_file(conf_file).with_content(%r{logs:\n- one\n- two}) }
5660
else
5761
it { is_expected.to contain_file(conf_file).with_content(%r{logs:\n - one\n - two}) }
5862
end
63+
it { is_expected.to contain_file(conf_file).with_ensure('file') }
5964
end
6065

6166
context 'with ensure absent' do
@@ -64,10 +69,10 @@
6469
ensure: 'absent',
6570
}
6671
end
72+
6773
it { is_expected.to compile }
6874
it { is_expected.to contain_file(conf_file).with_ensure('absent') }
6975
end
70-
7176
end
7277
end
7378
end

0 commit comments

Comments
 (0)