puppet-lint-top_scope_facts-check 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +8 -0
- data/lib/puppet-lint/plugins/top_scope_facts.rb +6 -1
- metadata +49 -22
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OWVjOWFjODU4MzYzNWQ4M2FhMWIyODdlNmQyYjM0Y2VkYzIxYTdiNg==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1d216228e3fd5bb68a999d49304c47895417da92a404bd75feed42ae69db21ea
|
4
|
+
data.tar.gz: ff786f21a35437e08b73dd6d332448e80f10739a2a6a230567cde8a263cca741
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MGI5OTk3YTFkYjJlZjIwZGFmYzkzYjE4YWJmYWIzYjJmOTg3YzQzOWU4Yzk1
|
11
|
-
MzAwYTMxN2I4NWRhMjI3OGU0YTg0MWY0OWMyNGUzYTc2NzMyYmM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MjU4YzFkNDYxOGNjNDI5NTA2NDQ1YjAxZmEwYzQ4YTY0Mjc4M2YxMTk3NGUx
|
14
|
-
ODI1YjQxZjg5YmNkYzUzMzhlMGU5YzRhYzdhNjI5NzI4NTBhYzFlOGI2ZTc4
|
15
|
-
YzdmYTc0NTA2ZmQzNzE2ZTBjZjc2YzZjODRiMTk1NjVkNzRlZjI=
|
6
|
+
metadata.gz: 7838ed6360a1312e3dea6f5ce5aa251bd2d6ffec0a791bf628c6189c4b94649d75ed08e0ecc4d66843fdebfdc58acb9c381bf1e16e9f2aab0f1af074a38b3da8
|
7
|
+
data.tar.gz: 902e575ab27bacb29c201465474ed1fc2bb22af00dfbebcb6dfe7e36e50201faea077157819405e419ac11d1029dabcce149de7aff1c621282e15f7a616128c2
|
data/README.md
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/mmckinst/puppet-lint-top_scope_facts-check.svg?branch=master)](https://travis-ci.org/mmckinst/puppet-lint-top_scope_facts-check)
|
2
|
+
[![Gem](https://img.shields.io/gem/v/puppet-lint-top_scope_facts-check.svg?maxAge=2592000)](https://rubygems.org/gems/puppet-lint-top_scope_facts-check)
|
3
|
+
![](https://img.shields.io/gem/dtv/puppet-lint-top_scope_facts-check.svg?style=flat)
|
4
|
+
![](https://img.shields.io/gem/dt/puppet-lint-top_scope_facts-check.svg?style=flat)
|
2
5
|
|
3
6
|
A puppet-lint plugin to check you are not using top scope fact variables like
|
4
7
|
`$::operatingsystem`. You should use the $facts hash like
|
5
8
|
`$facts['operatingsystem']` instead.
|
6
9
|
|
10
|
+
This linter will not covert from the legacy facts like
|
11
|
+
`$facts['operatingsystem']` to `$facts['os']['name']`. The [legacy
|
12
|
+
facts](https://github.com/mmckinst/puppet-lint-legacy_facts-check) linter can be
|
13
|
+
used to accomplish that.
|
14
|
+
|
7
15
|
## Overview
|
8
16
|
|
9
17
|
In puppet 2.x facts were top scope variables and accessed as `$operatingsystem`
|
@@ -1,8 +1,9 @@
|
|
1
1
|
PuppetLint.new_check(:top_scope_facts) do
|
2
|
+
VAR_TYPES = Set[:VARIABLE, :UNENC_VARIABLE]
|
2
3
|
def check
|
3
4
|
whitelist = ['trusted', 'facts'] + (PuppetLint.configuration.top_scope_variables || [])
|
4
5
|
whitelist = whitelist.join('|')
|
5
|
-
tokens.select { |x| x.type
|
6
|
+
tokens.select { |x| VAR_TYPES.include?(x.type) }.each do |token|
|
6
7
|
if token.value.match(/^::/) and not token.value.match(/^::(#{whitelist})\[?/)
|
7
8
|
notify :warning, {
|
8
9
|
:message => 'top scope fact instead of facts hash',
|
@@ -16,6 +17,10 @@ PuppetLint.new_check(:top_scope_facts) do
|
|
16
17
|
|
17
18
|
|
18
19
|
def fix(problem)
|
20
|
+
# This probably should never occur, but if it does then bail out:
|
21
|
+
raise PuppetLint::NoFix if problem[:token].raw and problem[:token].value != problem[:token].raw
|
22
|
+
|
19
23
|
problem[:token].value = "facts['" + problem[:token].value.sub(/^::/, '') + "']"
|
24
|
+
problem[:token].raw = problem[:token].value unless problem[:token].raw.nil?
|
20
25
|
end
|
21
26
|
end
|
metadata
CHANGED
@@ -1,88 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-top_scope_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:
|
11
|
+
date: 2019-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-its
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-json_expectations
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec-collection_matchers
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '1.0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
103
|
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- -
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
83
|
-
description:
|
84
|
-
|
85
|
-
|
111
|
+
description: |2
|
112
|
+
A puppet-lint plugin to check you are not using top scope fact variables like
|
113
|
+
$::operatingsystem. You should use the $facts hash like
|
114
|
+
$facts['operatingsystem'] instead.
|
86
115
|
email: mmckinst@umich.edu
|
87
116
|
executables: []
|
88
117
|
extensions: []
|
@@ -103,21 +132,19 @@ require_paths:
|
|
103
132
|
- lib
|
104
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
134
|
requirements:
|
106
|
-
- -
|
135
|
+
- - ">="
|
107
136
|
- !ruby/object:Gem::Version
|
108
137
|
version: '0'
|
109
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
139
|
requirements:
|
111
|
-
- -
|
140
|
+
- - ">="
|
112
141
|
- !ruby/object:Gem::Version
|
113
142
|
version: '0'
|
114
143
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.4.5
|
144
|
+
rubygems_version: 3.0.3
|
117
145
|
signing_key:
|
118
146
|
specification_version: 4
|
119
|
-
summary:
|
120
|
-
like $::operatingsystem
|
147
|
+
summary: Check for top scope facts and convert them to the facts hash
|
121
148
|
test_files:
|
122
|
-
- spec/puppet-lint/plugins/top_scope_facts_spec.rb
|
123
149
|
- spec/spec_helper.rb
|
150
|
+
- spec/puppet-lint/plugins/top_scope_facts_spec.rb
|