puppet-syntax 2.5.0 → 2.6.0

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
  SHA256:
3
- metadata.gz: cbbd3aba8d6bec0241405c588e3681c1f1e5a139d760b1ec395f80f7ca7ca121
4
- data.tar.gz: 7622c3904efa27007315dd1aa10d9301e103d183faa6abf08d1f3862f85f0f2f
3
+ metadata.gz: ed40e0315c9f5a3ae3f761b1d2af9779b1ab913e19057af9415bc88791a67d39
4
+ data.tar.gz: d4a7e69e7c1e57afe6d0d393469de33cb6c38fd683d985e1cdd9a1daa35317c6
5
5
  SHA512:
6
- metadata.gz: 90baf9b29551b81073c0ded34b3edbc5fd7a77478d5e25fa4f1054a7546505d06fb7e7b5fa0312379686500b5eb986648240e3e433af034b75578716e8720f72
7
- data.tar.gz: f88be032866ad40ccd014e43c1acd3b7ac31c4e53c9194b6d41a9141d6a44a3d9749807656d78dced4818c7542fa0a4740898d0e9d25cddd7839f2b8846f866b
6
+ metadata.gz: eddfdba6008c885abfefd649165d8aafa31fb920274f8a2cc5221a277bc3b789d637e998516618d066ee039d41032711da910524e39f39e233fd2eeb617b7ff6
7
+ data.tar.gz: baeedf5b248d065b73db5365ea11b31db5cab27a953a2158e7d09839e8e96230c26b8a652659bc33bc86f6be31fbf01a4ebd121c230d9d050064c9c4bffc9a33
@@ -7,6 +7,7 @@ script: bundle exec rake
7
7
  rvm:
8
8
  - 2.4.4
9
9
  - 2.5.1
10
+ - 2.6.5
10
11
  env:
11
12
  - PUPPET_VERSION="~> 5.5.10"
12
13
  - PUPPET_VERSION="~> 6.1.0"
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ## [v2.6.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.6.0) (2019-10-05)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.5.0...v2.6.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - add support for validating puppet plans \(fixes \#95, fixes \#96\) [\#97](https://github.com/voxpupuli/puppet-syntax/pull/97) ([slauger](https://github.com/slauger))
10
+ - Allow specifying file paths for manifests and templates too [\#87](https://github.com/voxpupuli/puppet-syntax/pull/87) ([lavagetto](https://github.com/lavagetto))
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Test on ruby 2.6 [\#111](https://github.com/voxpupuli/puppet-syntax/pull/111) ([alexjfisher](https://github.com/alexjfisher))
15
+ - Adding KMS tags to allowed EYAML methods [\#105](https://github.com/voxpupuli/puppet-syntax/pull/105) ([craigwatson](https://github.com/craigwatson))
4
16
 
5
17
  ## [v2.5.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.5.0) (2019-07-07)
6
18
 
@@ -10,6 +22,10 @@ All notable changes to this project will be documented in this file.
10
22
 
11
23
  - Support puppet 6.5 [\#106](https://github.com/voxpupuli/puppet-syntax/pull/106) ([alexjfisher](https://github.com/alexjfisher))
12
24
 
25
+ **Fixed bugs:**
26
+
27
+ - search manifests outside of manifests directory [\#104](https://github.com/voxpupuli/puppet-syntax/issues/104)
28
+
13
29
  ## [v2.4.3](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.3) (2019-02-09)
14
30
 
15
31
  [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.2...v2.4.3)
data/README.md CHANGED
@@ -51,6 +51,11 @@ To configure Puppet::Syntax, add any of the following settings to your `Rakefile
51
51
 
52
52
  PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
53
53
 
54
+ * To configure specific paths for the Puppet syntax checks or for the templates checks, specify `manifests_paths` or `templates_paths` respectively. This is useful if you want to check specific paths only.
55
+
56
+ PuppetSyntax.manifests_paths = ["**/environments/future/*.pp"]
57
+ PuppetSyntax.templates_paths = ["**/modules/**/templates/*.erb"]
58
+
54
59
  * To validate the syntax of code written for application orchestration, enable `app_management`:
55
60
 
56
61
  PuppetSyntax.app_management = true
@@ -12,6 +12,13 @@ module PuppetSyntax
12
12
  "hieradata/**/*.*{yaml,yml}",
13
13
  "hiera*.*{yaml,yml}"
14
14
  ]
15
+ @manifests_paths = [
16
+ '**/*.pp'
17
+ ]
18
+ @templates_paths = [
19
+ '**/templates/**/*.erb',
20
+ '**/templates/**/*.epp'
21
+ ]
15
22
  @fail_on_deprecation_notices = true
16
23
  @app_management = Puppet.version.to_i >= 5 ? true : false
17
24
  @check_hiera_keys = false
@@ -20,6 +27,8 @@ module PuppetSyntax
20
27
  attr_accessor :exclude_paths,
21
28
  :future_parser,
22
29
  :hieradata_paths,
30
+ :manifests_paths,
31
+ :templates_paths,
23
32
  :fail_on_deprecation_notices,
24
33
  :epp_only,
25
34
  :check_hiera_keys
@@ -56,7 +56,7 @@ module PuppetSyntax
56
56
  method = 'PKCS7'
57
57
  end
58
58
 
59
- return "has unknown eyaml method #{method}" unless ['PKCS7','GPG'].include? method
59
+ return "has unknown eyaml method #{method}" unless ['PKCS7','GPG','GKMS','KMS'].include? method
60
60
  return "has unpadded or truncated base64 data" unless base64.length % 4 == 0
61
61
 
62
62
  # Base64#decode64 will silently ignore characters outside the alphabet,
@@ -64,6 +64,7 @@ module PuppetSyntax
64
64
  def validate_manifest(file)
65
65
  Puppet[:parser] = 'future' if PuppetSyntax.future_parser and Puppet.version.to_i < 4
66
66
  Puppet[:app_management] = true if PuppetSyntax.app_management && (Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0 && Puppet.version.to_i < 5)
67
+ Puppet[:tasks] = true if Puppet::Util::Package.versioncmp(Puppet.version, '5.4.0') >= 0 and file.match(/.*plans\/.*\.pp$/)
67
68
  Puppet::Face[:parser, :current].validate(file)
68
69
  end
69
70
  end
@@ -13,11 +13,11 @@ module PuppetSyntax
13
13
  end
14
14
 
15
15
  def filelist_manifests
16
- filelist("**/*.pp")
16
+ filelist(PuppetSyntax.manifests_paths)
17
17
  end
18
18
 
19
19
  def filelist_templates
20
- filelist(["**/templates/**/*.erb", "**/templates/**/*.epp"])
20
+ filelist(PuppetSyntax.templates_paths)
21
21
  end
22
22
 
23
23
  def filelist_hiera_yaml
@@ -1,3 +1,3 @@
1
1
  module PuppetSyntax
2
- VERSION = '2.5.0'
2
+ VERSION = '2.6.0'
3
3
  end
@@ -2,6 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe PuppetSyntax::Templates do
4
4
  let(:subject) { PuppetSyntax::Templates.new }
5
+ let(:conditional_warning_regex) do
6
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0')
7
+ %r{2: warning: found `= literal' in conditional}
8
+ else
9
+ %r{2: warning: found = in conditional}
10
+ end
11
+ end
5
12
 
6
13
  it 'should expect an array of files' do
7
14
  expect { subject.check(nil) }.to raise_error(/Expected an array of files/)
@@ -34,7 +41,7 @@ describe PuppetSyntax::Templates do
34
41
  res = subject.check(files)
35
42
 
36
43
  expect(res.size).to eq(1)
37
- expect(res[0]).to match(/2: warning: found = in conditional/)
44
+ expect(res[0]).to match(conditional_warning_regex)
38
45
  end
39
46
 
40
47
  it 'should read more than one valid file' do
@@ -50,7 +57,7 @@ describe PuppetSyntax::Templates do
50
57
 
51
58
  expect(res.size).to eq(2)
52
59
  expect(res[0]).to match(/2: syntax error, unexpected/)
53
- expect(res[1]).to match(/2: warning: found = in conditional/)
60
+ expect(res[1]).to match(conditional_warning_regex)
54
61
  end
55
62
 
56
63
  it 'should ignore a TypeError' do
@@ -44,4 +44,12 @@ describe PuppetSyntax do
44
44
  expect(PuppetSyntax.epp_only).to eq(true)
45
45
  end
46
46
 
47
+ it 'should support setting paths for manifests, templates and hiera' do
48
+ PuppetSyntax.hieradata_paths = []
49
+ expect(PuppetSyntax.hieradata_paths).to eq([])
50
+ PuppetSyntax.manifests_paths = ["**/environments/production/**/*.pp"]
51
+ expect(PuppetSyntax.manifests_paths).to eq(["**/environments/production/**/*.pp"])
52
+ PuppetSyntax.templates_paths = []
53
+ expect(PuppetSyntax.templates_paths).to eq([])
54
+ end
47
55
  end
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.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-07 00:00:00.000000000 Z
11
+ date: 2019-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -142,7 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.0.4
145
+ rubyforge_project:
146
+ rubygems_version: 2.7.7
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Syntax checks for Puppet manifests, templates, and Hiera YAML