puppet-lint-fileserver-check 1.2.0 → 1.2.1

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: e2385520863deb2af2d03950b89a4bf0bbad4b7b
4
- data.tar.gz: 07a8c1a4be44ac43e7a8ef42b3ae2e4ccdc6a5b4
3
+ metadata.gz: 02c2f3a43158b08805bb51ac2afad8728c514fa6
4
+ data.tar.gz: de15da23deee73db54567cbabbb4ce76b57c5b93
5
5
  SHA512:
6
- metadata.gz: d9027849b1313dcfe8cd84fdffa0bf4e8848f4dbc5f9759b2c2b69d0710357fe0ec11018c4a79c6d7ae53bfff46ae7d75f142bb48ed444e5775b96ced62b5c11
7
- data.tar.gz: 93895b28f5e155e1448ec564f26754c79e0af066e5684b590600eb01ab6ce83d1210657628c667b03e09cbc32ef48e128d76d36596119c96b76bc3d18e9d6d2f
6
+ metadata.gz: 9ba84f2511002241d34edace57d29f617020bca497741d69f0e6b5c0ddcd453c04ce96eee5010484ee9fcf0e1c558b019159ec8cc4fe078d92ddb130372a2c1e
7
+ data.tar.gz: 84f99b95f27cf4e47d3cd7d6d16cb6c6a29c72d7842b6817a395ce2af4ae00596275e867a0db0a0baf6d3687ab78cc834a1f3a7fdbd9454a1cfc804712dac21c
@@ -1,10 +1,18 @@
1
1
  PuppetLint.new_check(:fileserver) do
2
+ def token_attr(resource, name)
3
+ resource[:tokens].select do |t|
4
+ t.type == :NAME && t.value == name && \
5
+ t.next_code_token && t.next_code_token.type == :FARROW
6
+ end
7
+ end
8
+
2
9
  def check
3
10
  resource_indexes.each do |resource|
4
11
  attr = resource[:tokens].select do |t|
5
12
  t.prev_code_token && t.prev_code_token.type == :FARROW && t.value =~ %r{^puppet:///}
6
13
  end
7
14
  next if attr.empty?
15
+ next if resource[:type].value == 'file' and !token_attr(resource, 'recurse').empty? and token_attr(resource, 'recurse')[0].next_code_token.next_code_token.type == :TRUE
8
16
  notify :warning, {
9
17
  :message => 'expected file() instead of fileserver',
10
18
  :line => attr[0].line,
@@ -29,7 +29,23 @@ describe 'fileserver' do
29
29
  EOS
30
30
  }
31
31
 
32
- it 'should detect a single problem' do
32
+ it 'should not detect any problem' do
33
+ expect(problems).to have(0).problem
34
+ end
35
+ end
36
+
37
+ context 'code using fileserver with puppet:/// and recurse=true' do
38
+ let(:code) {
39
+ <<-EOS
40
+ file { 'foo':
41
+ ensure => file,
42
+ recurse => true,
43
+ source => 'puppet:///modules/foo/bar',
44
+ }
45
+ EOS
46
+ }
47
+
48
+ it 'should not detect any problem' do
33
49
  expect(problems).to have(0).problem
34
50
  end
35
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-fileserver-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickaël Canévet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint