puppet-lint-fileserver-check 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02c2f3a43158b08805bb51ac2afad8728c514fa6
|
4
|
+
data.tar.gz: de15da23deee73db54567cbabbb4ce76b57c5b93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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-
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|