puppet-lint-legacy_facts-check 0.0.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/puppet-lint/plugins/legacy_facts.rb +2 -1
- data/spec/puppet-lint/plugins/legacy_facts_spec.rb +23 -2
- data/spec/spec_helper.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd3cb8032b34bedd7b911d90349ee7e0b921e09c72759da6333830975d060f6f
|
4
|
+
data.tar.gz: 6ab5ba872068cb338625ea655bb696d5f9d3d46599dfc7260f35aa745a2c0e40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357229fe8dd7417ebc38053ec7eeb174cefac881651dff55d47be03af62f04c6f936059f98499cf33cc9eb7e314c31d842b61b308b263322b3c89ae8dd04cbe8
|
7
|
+
data.tar.gz: 459f5115df04d1f6c682076a82ad8e3377d7786fb85b301f57d72baee2052ced015dfbf704b24477da6e6e875577124650137bfea40a14ed125d68843843266a
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/mmckinst/puppet-lint-legacy_facts-check.svg?branch=master)](https://travis-ci.org/mmckinst/puppet-lint-legacy_facts-check)
|
2
2
|
[![Gem](https://img.shields.io/gem/v/puppet-lint-legacy_facts-check.svg?maxAge=2592000)](https://rubygems.org/gems/puppet-lint-legacy_facts-check)
|
3
|
+
![](https://img.shields.io/gem/dtv/puppet-lint-legacy_facts-check.svg?style=flat)
|
4
|
+
![](https://img.shields.io/gem/dt/puppet-lint-legacy_facts-check.svg?style=flat)
|
3
5
|
|
4
6
|
## Overview
|
5
7
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
PuppetLint.new_check(:legacy_facts) do
|
2
|
+
VAR_TYPES = Set[:VARIABLE, :UNENC_VARIABLE]
|
2
3
|
|
3
4
|
# These facts that can't be converted to new facts for reasons documented at
|
4
5
|
# https://github.com/mmckinst/puppet-lint-legacy_facts-check#limitations
|
@@ -96,7 +97,7 @@ PuppetLint.new_check(:legacy_facts) do
|
|
96
97
|
'zonename' => "facts['solaris_zones']['current']",
|
97
98
|
}
|
98
99
|
def check
|
99
|
-
tokens.select { |x| x.type
|
100
|
+
tokens.select { |x| VAR_TYPES.include?(x.type) }.each do |token|
|
100
101
|
fact_name = ''
|
101
102
|
|
102
103
|
# Get rid of the top scope before we do our work. We don't need to
|
@@ -22,7 +22,7 @@ describe 'legacy_facts' do
|
|
22
22
|
context "fact variable using legacy $osfamily" do
|
23
23
|
let(:code) { "$osfamily" }
|
24
24
|
|
25
|
-
it 'should
|
25
|
+
it 'should not detect any problems' do
|
26
26
|
expect(problems).to have(0).problem
|
27
27
|
end
|
28
28
|
end
|
@@ -98,6 +98,14 @@ describe 'legacy_facts' do
|
|
98
98
|
expect(problems).to have(1).problem
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
context "fact variable using legacy variable in double quotes \"$::osfamily\"" do
|
103
|
+
let(:code) { "\"$::osfamily\"" }
|
104
|
+
|
105
|
+
it 'should only detect a single problem' do
|
106
|
+
expect(problems).to have(1).problem
|
107
|
+
end
|
108
|
+
end
|
101
109
|
end
|
102
110
|
|
103
111
|
|
@@ -129,9 +137,10 @@ describe 'legacy_facts' do
|
|
129
137
|
context "fact variable using legacy $osfamily" do
|
130
138
|
let(:code) { "$osfamily" }
|
131
139
|
|
132
|
-
it 'should
|
140
|
+
it 'should not detect any problems' do
|
133
141
|
expect(problems).to have(0).problem
|
134
142
|
end
|
143
|
+
|
135
144
|
end
|
136
145
|
|
137
146
|
context "fact variable using legacy $facts['osfamily']" do
|
@@ -271,5 +280,17 @@ describe 'legacy_facts' do
|
|
271
280
|
expect(manifest).to eq('"start '"${facts['os']['family']}"' end"')
|
272
281
|
end
|
273
282
|
end
|
283
|
+
|
284
|
+
context "fact variable using legacy variable in double quotes \"$::osfamily\"" do
|
285
|
+
let(:code) { "\"$::osfamily\"" }
|
286
|
+
|
287
|
+
it 'should only detect a single problem' do
|
288
|
+
expect(problems).to have(1).problem
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'should use the facts hash' do
|
292
|
+
expect(manifest).to eq("\"$facts['os']['family']\"")
|
293
|
+
end
|
294
|
+
end
|
274
295
|
end
|
275
296
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-legacy_facts-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark McKinstry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.0.
|
144
|
+
rubygems_version: 3.0.3
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: A puppet-lint plugin to check you are not using legacy facts like $::operatingsystem
|