puppet-syntax 2.4.0 → 2.4.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: 6606744a1866c599818bf66f5049dd0fdafeaa68
4
- data.tar.gz: 353c86d96ce6356fa46fddcbb66eb8429ee81a3a
3
+ metadata.gz: 8f3a393428ed2fa0c2d2bfcf1f540d80589d5d16
4
+ data.tar.gz: 8a40d90b8a844849051064d8d3042bd568da95a0
5
5
  SHA512:
6
- metadata.gz: 3ea3d4e1c1f63a3f7f92dcd1d99e3401004c3e6eec01036d2227f0127b45d01a7790f58f9147b4f9d172649aa4264aed100da2e9a822179f5b68b6363616de85
7
- data.tar.gz: e50e01a78dcf9b35ee36be7866e1328ab39df08dbab5d45f45a7bdcd4ef06e9ffdc5149df7227dbf92f8e461be9b92f23c84d231b07e410a20ac401963259a0e
6
+ metadata.gz: 37e9b85d01f0ec31b29a6ecbbe264f3e6d714af42d83b1d7f08db735fbd7b09b058e516d639b976a4a6e6a097f7c87db82beeb4ee52a529f672599549284a45f
7
+ data.tar.gz: 1786cccadd25ace8e001fdaa4bf4a0b0966ed90726709595f7a291020726754992857261b2f46fdee1032f9cb6c65f514e8d24ca5433891b9ed1234781fed997
@@ -2,6 +2,7 @@
2
2
  language: ruby
3
3
  # Workaround https://github.com/bundler/bundler/issues/3558
4
4
  before_install: gem install bundler
5
+ install: bundle install --jobs 4 --retry 2 --without development
5
6
  script: bundle exec rake
6
7
  rvm:
7
8
  - 1.9.3
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
- This should work on any version of:
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
- You can see the matrix of specific versions that we currently test against
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
- ## Usage
20
+ ## Installation
25
21
 
26
- Include the following in your `Rakefile`:
22
+ To install Puppet::Syntax, either add it to your module's Gemfile or install the gem manually.
27
23
 
28
- require 'puppet-syntax/tasks/puppet-syntax'
24
+ * To install with the Gemfile, add:
29
25
 
30
- Test all manifests and templates relative to your `Rakefile`:
26
+ gem 'puppet-syntax'
31
27
 
32
- puppet git:(master) bundle exec rake syntax
33
- ---> syntax:manifests
34
- ---> syntax:templates
35
- ---> syntax:hiera:yaml
28
+ And then execute:
36
29
 
37
- A non-zero exit code and error message will be returned for any failures:
30
+ $ bundle install
38
31
 
39
- ➜ puppet git:(master) bundle exec rake syntax
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
- Use in conjunction with lint and spec tests for Continuous Integration:
34
+ $ gem install puppet-syntax
47
35
 
48
- task :test => [
49
- :syntax,
50
- :lint,
51
- :spec,
52
- ]
36
+ ## Configuration
53
37
 
54
- ## Checks
38
+ To configure Puppet::Syntax, add any of the following settings to your `Rakefile`.
55
39
 
56
- ### hiera
40
+ * To exclude certain paths from the syntax checks, set:
57
41
 
58
- Checks `.yaml` files for syntax errors.
42
+ PuppetSyntax.exclude_paths = ["vendor/**/*"]
59
43
 
60
- By default, the rake task will look for all `.yaml` files under:
44
+ * To use the Puppet 4 ("future") parser in Puppet 3.2 through 3.8, set:
61
45
 
62
- * `**/data/**/*.yaml`
63
- * `hieradata/**/*.yaml`
64
- * `hiera*.yaml`
46
+ PuppetSyntax.future_parser = true
65
47
 
66
- ### manifests
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
- Checks `.pp` files for syntax errors
50
+ PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
69
51
 
70
- ### templates
52
+ * To validate the syntax of code written for application orchestration, enable `app_management`:
71
53
 
72
- #### erb
54
+ PuppetSyntax.app_management = true
73
55
 
74
- Checks `.erb` files for syntax errors
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
- #### epp
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
- Checks `.epp` files for syntax errors.
60
+ PuppetSyntax.fail_on_deprecation_notices = false
79
61
 
80
- Note: This will only occur when Puppet version specified is Puppet 4+ or Puppet 3 with the future parser enabled
62
+ * To enable a syntax check on Hiera keys, set:
81
63
 
82
- ## Configuration
64
+ PuppetSyntax.check_hiera_keys = true
83
65
 
84
- Paths can be excluded with:
66
+ This reports common mistakes in key names in Hiera files, such as:
85
67
 
86
- PuppetSyntax.exclude_paths = ["vendor/**/*"]
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
- When you are using a Puppet version greater then 3.2, you can select the future parse by specifying
73
+ ## Usage
89
74
 
90
- PuppetSyntax.future_parser = true
75
+ * To enable Puppet::Syntax, include the following in your module's `Rakefile`:
91
76
 
92
- If you are using some form of hiera data inside your module, you can configure where the `syntax:hiera:yaml` task looks for data with:
77
+ require 'puppet-syntax/tasks/puppet-syntax'
93
78
 
94
- PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
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
- If you are trying to validate the syntax of code written for application orchestration, you can enable the `app_management` setting:
81
+ task :test => [
82
+ :syntax,
83
+ :lint,
84
+ :spec,
85
+ ]
97
86
 
98
- PuppetSyntax.app_management = true
87
+ * To test all manifests and templates, relative to the location of the `Rakefile`, run:
99
88
 
100
- `app_management` is supported on Puppet 4.3 or higher, defaulting to off. On Puppet 5, it is always enabled.
89
+ $ bundle exec rake syntax
90
+ ---> syntax:manifests
91
+ ---> syntax:templates
92
+ ---> syntax:hiera:yaml
101
93
 
102
- Deprecation notices will cause a failure by default, you can override this functionality by setting:
94
+ * To return a non-zero exit code and an error message on any failures, run:
103
95
 
104
- PuppetSyntax.fail_on_deprecation_notices = false
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
- Common mistakes in key names in Hiera files will be reported:
103
+ ## Checks
107
104
 
108
- - Leading :: in keys eg. `::notsotypical::warning2: true`
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
- This can be enabled by setting
107
+ ### Hiera
114
108
 
115
- PuppetSyntax.check_hiera_keys = true
109
+ Checks `.yaml` files for syntax errors.
116
110
 
117
- ## Installation
111
+ By default, this rake task looks for all `.yaml` files in a single module under:
118
112
 
119
- Add this line to your application's Gemfile:
113
+ * `**/data/**/*.yaml`
114
+ * `hieradata/**/*.yaml`
115
+ * `hiera*.yaml`
120
116
 
121
- gem 'puppet-syntax'
117
+ ### manifests
122
118
 
123
- And then execute:
119
+ Checks all `.pp` files in the module for syntax errors.
124
120
 
125
- $ bundle
121
+ ### templates
122
+
123
+ #### erb
124
+
125
+ Checks `.erb` files in the module for syntax errors.
126
+
127
+ #### epp
126
128
 
127
- Or install it yourself as:
129
+ Checks `.epp` files in the module for syntax errors.
128
130
 
129
- $ gem install puppet-syntax
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 it
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.
@@ -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 = Rake::Task[:syntax].actions.any? { |a|
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
- print "#{output.join("\n")}\n" unless output.empty?
69
- fail if has_errors || ( output.any? && PuppetSyntax.fail_on_deprecation_notices )
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
- fail errors.join("\n") unless errors.empty?
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
- fail errors.join("\n") unless errors.empty?
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
@@ -1,3 +1,3 @@
1
1
  module PuppetSyntax
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
  end
@@ -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.0
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-03-14 00:00:00.000000000 Z
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.8
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