puppet-syntax 2.4.0 → 2.4.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 +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG +4 -0
- data/Gemfile +4 -0
- data/README.md +78 -76
- data/appveyor.yml +38 -0
- data/lib/puppet-syntax/tasks/puppet-syntax.rb +7 -5
- data/lib/puppet-syntax/version.rb +1 -1
- data/puppet-syntax.gemspec +0 -1
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f3a393428ed2fa0c2d2bfcf1f540d80589d5d16
|
4
|
+
data.tar.gz: 8a40d90b8a844849051064d8d3042bd568da95a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37e9b85d01f0ec31b29a6ecbbe264f3e6d714af42d83b1d7f08db735fbd7b09b058e516d639b976a4a6e6a097f7c87db82beeb4ee52a529f672599549284a45f
|
7
|
+
data.tar.gz: 1786cccadd25ace8e001fdaa4bf4a0b0966ed90726709595f7a291020726754992857261b2f46fdee1032f9cb6c65f514e8d24ca5433891b9ed1234781fed997
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
2017-06-29 Release 2.4.1
|
2
|
+
- Fix to ensure namespace scope is inherited.
|
3
|
+
- Cleanly exits when syntax warnings/errors are found instead of failing.
|
4
|
+
|
1
5
|
2017-03-14 Release 2.4.0
|
2
6
|
- Add check_hiera_keys flag for deep checking of Hiera key name correctness. Thanks @petems.
|
3
7
|
- Fix Puppet version comparisons for compatibility with Puppet 4.10.
|
data/Gemfile
CHANGED
@@ -22,3 +22,7 @@ gem 'puppet', *location_for(ENV['PUPPET_VERSION'] || '>2.7.0')
|
|
22
22
|
|
23
23
|
# older version required for ruby 1.9 compat, as it is pulled in as dependency of puppet, this has to be carried by the module
|
24
24
|
gem 'json_pure', '<= 2.0.1'
|
25
|
+
|
26
|
+
group :test do
|
27
|
+
gem 'rspec'
|
28
|
+
end
|
data/README.md
CHANGED
@@ -2,136 +2,138 @@
|
|
2
2
|
|
3
3
|
# Puppet::Syntax
|
4
4
|
|
5
|
-
Syntax checks for Puppet manifests, templates, and Hiera YAML.
|
5
|
+
Puppet::Syntax checks for correct syntax in Puppet manifests, templates, and Hiera YAML.
|
6
6
|
|
7
7
|
## Version support
|
8
8
|
|
9
|
-
|
9
|
+
Puppet::Syntax is supported with:
|
10
10
|
|
11
11
|
- Puppet >= 2.7 that provides the `validate` face.
|
12
|
-
- Ruby >= 1.8 with `erb` from stdlib.
|
12
|
+
- Ruby >= 1.8 with `erb` from Ruby stdlib.
|
13
13
|
|
14
|
-
|
15
|
-
in the [TravisCI config](.travis.yml).
|
14
|
+
For the specific versions that we test against, see the [TravisCI config](.travis.yml).
|
16
15
|
|
17
|
-
If you're using `puppetlabs_spec_helper/rake_tasks` and getting unexpected
|
18
|
-
non-zero exit codes then you should upgrade to [puppetlabs_spec_helper][psh]
|
19
|
-
\>= 0.8.0 which no longer has a conflicting rake task and now depends on
|
20
|
-
this project.
|
16
|
+
If you're using `puppetlabs_spec_helper/rake_tasks` and getting unexpected non-zero exit codes, upgrade to [puppetlabs_spec_helper][psh] version 0.8.0 or greater. Versions of `puppetlabs_spec_helper` prior to 0.8.0 conflicted with Puppet::Syntax.
|
21
17
|
|
22
18
|
[psh]: https://github.com/puppetlabs/puppetlabs_spec_helper
|
23
19
|
|
24
|
-
##
|
20
|
+
## Installation
|
25
21
|
|
26
|
-
|
22
|
+
To install Puppet::Syntax, either add it to your module's Gemfile or install the gem manually.
|
27
23
|
|
28
|
-
|
24
|
+
* To install with the Gemfile, add:
|
29
25
|
|
30
|
-
|
26
|
+
gem 'puppet-syntax'
|
31
27
|
|
32
|
-
|
33
|
-
---> syntax:manifests
|
34
|
-
---> syntax:templates
|
35
|
-
---> syntax:hiera:yaml
|
28
|
+
And then execute:
|
36
29
|
|
37
|
-
|
30
|
+
$ bundle install
|
38
31
|
|
39
|
-
|
40
|
-
---> syntax:manifests
|
41
|
-
rake aborted!
|
42
|
-
Could not parse for environment production: Syntax error at end of file at demo.pp:2
|
43
|
-
Tasks: TOP => syntax => syntax:manifests
|
44
|
-
(See full trace by running task with --trace)
|
32
|
+
* To install the gem yourself, run:
|
45
33
|
|
46
|
-
|
34
|
+
$ gem install puppet-syntax
|
47
35
|
|
48
|
-
|
49
|
-
:syntax,
|
50
|
-
:lint,
|
51
|
-
:spec,
|
52
|
-
]
|
36
|
+
## Configuration
|
53
37
|
|
54
|
-
|
38
|
+
To configure Puppet::Syntax, add any of the following settings to your `Rakefile`.
|
55
39
|
|
56
|
-
|
40
|
+
* To exclude certain paths from the syntax checks, set:
|
57
41
|
|
58
|
-
|
42
|
+
PuppetSyntax.exclude_paths = ["vendor/**/*"]
|
59
43
|
|
60
|
-
|
44
|
+
* To use the Puppet 4 ("future") parser in Puppet 3.2 through 3.8, set:
|
61
45
|
|
62
|
-
|
63
|
-
* `hieradata/**/*.yaml`
|
64
|
-
* `hiera*.yaml`
|
46
|
+
PuppetSyntax.future_parser = true
|
65
47
|
|
66
|
-
|
48
|
+
* To configure specific paths for the Hiera syntax check, specify `hieradata_paths`. This is useful if you use Hiera data inside your module.
|
67
49
|
|
68
|
-
|
50
|
+
PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
|
69
51
|
|
70
|
-
|
52
|
+
* To validate the syntax of code written for application orchestration, enable `app_management`:
|
71
53
|
|
72
|
-
|
54
|
+
PuppetSyntax.app_management = true
|
73
55
|
|
74
|
-
|
56
|
+
The `app_management` setting is supported with Puppet 4.3 or greater and is off by default. In Puppet 5, app_management is always enabled.
|
75
57
|
|
76
|
-
|
58
|
+
* To ignore deprecation warnings, disable `fail_on_deprecation_notices`. By default, `puppet-syntax` fails if it encounters Puppet deprecation notices. If you are working with a legacy code base and want to ignore such non-fatal warnings, you might want to override the default behavior.
|
77
59
|
|
78
|
-
|
60
|
+
PuppetSyntax.fail_on_deprecation_notices = false
|
79
61
|
|
80
|
-
|
62
|
+
* To enable a syntax check on Hiera keys, set:
|
81
63
|
|
82
|
-
|
64
|
+
PuppetSyntax.check_hiera_keys = true
|
83
65
|
|
84
|
-
|
66
|
+
This reports common mistakes in key names in Hiera files, such as:
|
85
67
|
|
86
|
-
|
68
|
+
- Leading `::` in keys, such as: `::notsotypical::warning2: true`.
|
69
|
+
- Single colon scope separators, such as: `:picky::warning5: true`.
|
70
|
+
- Invalid camel casing, such as: `noCamelCase::warning3: true`.
|
71
|
+
- Use of hyphens, such as: `no-hyphens::warning4: true`.
|
87
72
|
|
88
|
-
|
73
|
+
## Usage
|
89
74
|
|
90
|
-
|
75
|
+
* To enable Puppet::Syntax, include the following in your module's `Rakefile`:
|
91
76
|
|
92
|
-
|
77
|
+
require 'puppet-syntax/tasks/puppet-syntax'
|
93
78
|
|
94
|
-
|
79
|
+
For Continuous Integration, use Puppet::Syntax in conjunction with `puppet-lint` and spec tests. Add the following to your module's `Rakefile`:
|
95
80
|
|
96
|
-
|
81
|
+
task :test => [
|
82
|
+
:syntax,
|
83
|
+
:lint,
|
84
|
+
:spec,
|
85
|
+
]
|
97
86
|
|
98
|
-
|
87
|
+
* To test all manifests and templates, relative to the location of the `Rakefile`, run:
|
99
88
|
|
100
|
-
|
89
|
+
$ bundle exec rake syntax
|
90
|
+
---> syntax:manifests
|
91
|
+
---> syntax:templates
|
92
|
+
---> syntax:hiera:yaml
|
101
93
|
|
102
|
-
|
94
|
+
* To return a non-zero exit code and an error message on any failures, run:
|
103
95
|
|
104
|
-
|
96
|
+
$ bundle exec rake syntax
|
97
|
+
---> syntax:manifests
|
98
|
+
rake aborted!
|
99
|
+
Could not parse for environment production: Syntax error at end of file at demo.pp:2
|
100
|
+
Tasks: TOP => syntax => syntax:manifests
|
101
|
+
(See full trace by running task with --trace)
|
105
102
|
|
106
|
-
|
103
|
+
## Checks
|
107
104
|
|
108
|
-
|
109
|
-
- Single colon scope seperators eg. `:picky::warning5: true`
|
110
|
-
- Invalid camel casing eg. `noCamelCase::warning3: true`
|
111
|
-
- Use of hyphens eg. `no-hyphens::warning4: true`
|
105
|
+
Puppet::Syntax makes the following checks in the directories and subdirectories of the module, relative to the location of the `Rakefile`.
|
112
106
|
|
113
|
-
|
107
|
+
### Hiera
|
114
108
|
|
115
|
-
|
109
|
+
Checks `.yaml` files for syntax errors.
|
116
110
|
|
117
|
-
|
111
|
+
By default, this rake task looks for all `.yaml` files in a single module under:
|
118
112
|
|
119
|
-
|
113
|
+
* `**/data/**/*.yaml`
|
114
|
+
* `hieradata/**/*.yaml`
|
115
|
+
* `hiera*.yaml`
|
120
116
|
|
121
|
-
|
117
|
+
### manifests
|
122
118
|
|
123
|
-
|
119
|
+
Checks all `.pp` files in the module for syntax errors.
|
124
120
|
|
125
|
-
|
121
|
+
### templates
|
122
|
+
|
123
|
+
#### erb
|
124
|
+
|
125
|
+
Checks `.erb` files in the module for syntax errors.
|
126
|
+
|
127
|
+
#### epp
|
126
128
|
|
127
|
-
|
129
|
+
Checks `.epp` files in the module for syntax errors.
|
128
130
|
|
129
|
-
|
131
|
+
EPP checks are supported in Puppet 4 or greater, or in Puppet 3 with the future parser enabled.
|
130
132
|
|
131
133
|
## Contributing
|
132
134
|
|
133
|
-
1. Fork
|
134
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
135
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
136
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
137
|
-
5. Create new Pull Request
|
135
|
+
1. Fork the repo.
|
136
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
137
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
138
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
139
|
+
5. Create new Pull Request.
|
data/appveyor.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
build: off
|
2
|
+
|
3
|
+
branches:
|
4
|
+
only:
|
5
|
+
- master
|
6
|
+
|
7
|
+
# ruby versions under test
|
8
|
+
environment:
|
9
|
+
matrix:
|
10
|
+
- RUBY_VERSION: 21
|
11
|
+
PUPPET_VERSION: "~> 3.8.7"
|
12
|
+
- RUBY_VERSION: 21
|
13
|
+
PUPPET_VERSION: "~> 4.8.0"
|
14
|
+
- RUBY_VERSION: 23-x64
|
15
|
+
PUPPET_VERSION: "~> 4.9.0"
|
16
|
+
- RUBY_VERSION: 23-x64
|
17
|
+
PUPPET_VERSION: "> 0"
|
18
|
+
- RUBY_VERSION: 23-x64
|
19
|
+
PUPPET_VERSION: "git://github.com/puppetlabs/puppet.git#master"
|
20
|
+
|
21
|
+
matrix:
|
22
|
+
allow_failures:
|
23
|
+
- RUBY_VERSION: 23-x64
|
24
|
+
PUPPET_VERSION: "git://github.com/puppetlabs/puppet.git#master"
|
25
|
+
|
26
|
+
install:
|
27
|
+
- SET PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
28
|
+
- SET LOG_SPEC_ORDER=true
|
29
|
+
- bundle install --jobs 4 --retry 2 --without development
|
30
|
+
|
31
|
+
before_test:
|
32
|
+
- type Gemfile.lock
|
33
|
+
- ruby -v
|
34
|
+
- gem -v
|
35
|
+
- bundle -v
|
36
|
+
|
37
|
+
test_script:
|
38
|
+
- bundle exec rake spec
|
@@ -33,7 +33,7 @@ module PuppetSyntax
|
|
33
33
|
|
34
34
|
namespace :syntax do
|
35
35
|
task :check_puppetlabs_spec_helper do
|
36
|
-
psh_present =
|
36
|
+
psh_present = task(:syntax).actions.any? { |a|
|
37
37
|
a.inspect.match(/puppetlabs_spec_helper\/rake_tasks\.rb:\d+/)
|
38
38
|
}
|
39
39
|
|
@@ -65,8 +65,8 @@ version is less then 4.3. The `app_management` setting will be ignored.
|
|
65
65
|
|
66
66
|
c = PuppetSyntax::Manifests.new
|
67
67
|
output, has_errors = c.check(filelist_manifests)
|
68
|
-
|
69
|
-
|
68
|
+
$stdout.puts "#{output.join("\n")}\n" unless output.empty?
|
69
|
+
exit 1 if has_errors || ( output.any? && PuppetSyntax.fail_on_deprecation_notices )
|
70
70
|
end
|
71
71
|
|
72
72
|
desc 'Syntax check Puppet templates'
|
@@ -75,7 +75,8 @@ version is less then 4.3. The `app_management` setting will be ignored.
|
|
75
75
|
|
76
76
|
c = PuppetSyntax::Templates.new
|
77
77
|
errors = c.check(filelist_templates)
|
78
|
-
|
78
|
+
$stdout.puts "#{errors.join("\n")}\n" unless errors.empty?
|
79
|
+
exit 1 unless errors.empty?
|
79
80
|
end
|
80
81
|
|
81
82
|
desc 'Syntax check Hiera config files'
|
@@ -88,7 +89,8 @@ version is less then 4.3. The `app_management` setting will be ignored.
|
|
88
89
|
$stderr.puts "---> #{t.name}"
|
89
90
|
c = PuppetSyntax::Hiera.new
|
90
91
|
errors = c.check(filelist_hiera_yaml)
|
91
|
-
|
92
|
+
$stdout.puts "#{errors.join("\n")}\n" unless errors.empty?
|
93
|
+
exit 1 unless errors.empty?
|
92
94
|
end
|
93
95
|
end
|
94
96
|
end
|
data/puppet-syntax.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency "rake"
|
22
22
|
|
23
|
-
spec.add_development_dependency "rspec"
|
24
23
|
spec.add_development_dependency "pry"
|
25
24
|
spec.add_development_dependency "rb-readline"
|
26
25
|
spec.add_development_dependency "gem_publisher", "~> 1.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-syntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: pry
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +80,7 @@ files:
|
|
94
80
|
- LICENSE.txt
|
95
81
|
- README.md
|
96
82
|
- Rakefile
|
83
|
+
- appveyor.yml
|
97
84
|
- jenkins.sh
|
98
85
|
- lib/puppet-syntax.rb
|
99
86
|
- lib/puppet-syntax/hiera.rb
|
@@ -155,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
142
|
version: '0'
|
156
143
|
requirements: []
|
157
144
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.6.
|
145
|
+
rubygems_version: 2.6.11
|
159
146
|
signing_key:
|
160
147
|
specification_version: 4
|
161
148
|
summary: Syntax checks for Puppet manifests, templates, and Hiera YAML
|