puppet-lint-fileserver-check 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f29951ef181d127ebc193fec7eed34353148bec0
4
- data.tar.gz: 617f106be6a01288f8d802c5e394d4eab9eab128
3
+ metadata.gz: e2385520863deb2af2d03950b89a4bf0bbad4b7b
4
+ data.tar.gz: 07a8c1a4be44ac43e7a8ef42b3ae2e4ccdc6a5b4
5
5
  SHA512:
6
- metadata.gz: 0f532ff5320204e0817e359f62ef1c4a89e27926a8126aa3fc748baf5490a78f60a4cbc5a8846c3f1a2fce27a1a9313d6647dc2e96f73edc0c1e9a0f60fa9d1e
7
- data.tar.gz: 1d41a86a47f7fbf9cc480c9a6a36b6ef558fdda66ab0b9a931359c5b1cb6c6c56d881c3cf3926013f7291f1b93c9a0df109d15d17323cf56245f8baf26060345
6
+ metadata.gz: d9027849b1313dcfe8cd84fdffa0bf4e8848f4dbc5f9759b2c2b69d0710357fe0ec11018c4a79c6d7ae53bfff46ae7d75f142bb48ed444e5775b96ced62b5c11
7
+ data.tar.gz: 93895b28f5e155e1448ec564f26754c79e0af066e5684b590600eb01ab6ce83d1210657628c667b03e09cbc32ef48e128d76d36596119c96b76bc3d18e9d6d2f
@@ -16,7 +16,8 @@ PuppetLint.new_check(:fileserver) do
16
16
  end
17
17
 
18
18
  def fix(problem)
19
- if problem[:resource][:type].value == 'file'
19
+ if problem[:resource][:type].value == 'file' or
20
+ problem[:resource][:type].value == 'concat::fragment'
20
21
  if problem[:token].type == :SSTRING
21
22
  problem[:token].prev_code_token.prev_code_token.value = 'content'
22
23
  problem[:token].value.sub!(%r{^puppet:///modules/(.*)}, "file('\\1')")
@@ -72,6 +72,25 @@ describe 'fileserver' do
72
72
  end
73
73
  end
74
74
 
75
+ context 'when using fileserver in concat::fragment' do
76
+ let(:code) {
77
+ <<-EOS
78
+ concat::fragment { 'foo':
79
+ ensure => present,
80
+ source => 'puppet:///modules/foo/bar',
81
+ }
82
+ EOS
83
+ }
84
+
85
+ it 'should detect a single problem' do
86
+ expect(problems).to have(1).problem
87
+ end
88
+
89
+ it 'should create a warning' do
90
+ expect(problems).to contain_warning(msg).on_line(3).in_column(21)
91
+ end
92
+ end
93
+
75
94
  context 'when using fileserver not in file resource' do
76
95
  let(:code) {
77
96
  <<-EOS
@@ -216,6 +235,37 @@ describe 'fileserver' do
216
235
  end
217
236
  end
218
237
 
238
+
239
+ context 'when using fileserver in concat::fragment' do
240
+ let(:code) {
241
+ <<-EOS
242
+ concat::fragment { 'foo':
243
+ ensure => present,
244
+ source => 'puppet:///modules/foo/bar',
245
+ }
246
+ EOS
247
+ }
248
+
249
+ it 'should detect a single problem' do
250
+ expect(problems).to have(1).problem
251
+ end
252
+
253
+ it 'should fix the problem' do
254
+ expect(problems).to contain_fixed(msg).on_line(3).in_column(21)
255
+ end
256
+
257
+ it 'should fix the code' do
258
+ expect(manifest).to eq(
259
+ <<-EOS
260
+ concat::fragment { 'foo':
261
+ ensure => present,
262
+ content => file('foo/bar'),
263
+ }
264
+ EOS
265
+ )
266
+ end
267
+ end
268
+
219
269
  context 'code using a variable' do
220
270
  let(:code) {
221
271
  <<-EOS
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-fileserver-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickaël Canévet