puppet-syntax 7.0.1 → 7.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c458096b405b193f2744bcc269314df50710bc6f0d6a42c86395cddceb7091ed
4
- data.tar.gz: 28c88220e7b0f978a6672590b31e297b3fc4b63b5ce9fdc7c0565d2f8599cb5f
3
+ metadata.gz: c3bc359cbcfcfa56f7c5ebe703c2039328ff08bba9b5fe000ece398f8f694bb5
4
+ data.tar.gz: 768b276e670cb5f39097dd6d7ada811d8c065b7a36f0115b8b12beb413e5f4ed
5
5
  SHA512:
6
- metadata.gz: 975c1f133c087f92b35e173dfa755a9e3f688f9bfaf0f9bbbecb247238db285bb0997edf549091e6303b8ca11cc6e8ef9296bd2c34d7159cdf10dd6fd6f8cbe3
7
- data.tar.gz: 02cb4c1027b2307fa4718716956c877cb40f95792d63fcd4535fcffc248648efb5419542eeb7f918f77a907a1d891215a189f1e4584ff326e301ff4386954c85
6
+ metadata.gz: af79416abfe17e8685da8c25e3c7b93418279261eeca403686cbc2ba1ef32160c17526582de9ef34031285c81fe0cee6cd0167c5af542755ccb1878e419e08f7
7
+ data.tar.gz: 963a76a7c5215f642144e34dc92a4611d8bb48bcce0272f10775e2a89061e65cbd4cfd2eb675c676a38748ec6086512ee4e8b28b81ac465c75bc5bef3a47ec72
@@ -15,7 +15,7 @@ jobs:
15
15
  name: Build the gem
16
16
  runs-on: ubuntu-24.04
17
17
  steps:
18
- - uses: actions/checkout@v5
18
+ - uses: actions/checkout@v6
19
19
  - name: Install Ruby
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
@@ -24,7 +24,7 @@ jobs:
24
24
  shell: bash
25
25
  run: gem build --verbose *.gemspec
26
26
  - name: Upload gem to GitHub cache
27
- uses: actions/upload-artifact@v4
27
+ uses: actions/upload-artifact@v6
28
28
  with:
29
29
  name: gem-artifact
30
30
  path: '*.gem'
@@ -39,7 +39,7 @@ jobs:
39
39
  contents: write # clone repo and create release
40
40
  steps:
41
41
  - name: Download gem from GitHub cache
42
- uses: actions/download-artifact@v5
42
+ uses: actions/download-artifact@v7
43
43
  with:
44
44
  name: gem-artifact
45
45
  - name: Create Release
@@ -56,7 +56,7 @@ jobs:
56
56
  packages: write # publish to rubygems.pkg.github.com
57
57
  steps:
58
58
  - name: Download gem from GitHub cache
59
- uses: actions/download-artifact@v5
59
+ uses: actions/download-artifact@v7
60
60
  with:
61
61
  name: gem-artifact
62
62
  - name: Publish gem to GitHub packages
@@ -73,7 +73,7 @@ jobs:
73
73
  id-token: write # rubygems.org authentication
74
74
  steps:
75
75
  - name: Download gem from GitHub cache
76
- uses: actions/download-artifact@v5
76
+ uses: actions/download-artifact@v7
77
77
  with:
78
78
  name: gem-artifact
79
79
  - uses: rubygems/configure-rubygems-credentials@v1.0.0
@@ -92,7 +92,7 @@ jobs:
92
92
  - release-to-rubygems
93
93
  steps:
94
94
  - name: Download gem from GitHub cache
95
- uses: actions/download-artifact@v5
95
+ uses: actions/download-artifact@v7
96
96
  with:
97
97
  name: gem-artifact
98
98
  - name: Install Ruby
@@ -20,7 +20,7 @@ jobs:
20
20
  outputs:
21
21
  ruby: ${{ steps.ruby.outputs.versions }}
22
22
  steps:
23
- - uses: actions/checkout@v5
23
+ - uses: actions/checkout@v6
24
24
  - name: Install Ruby ${{ matrix.ruby }}
25
25
  uses: ruby/setup-ruby@v1
26
26
  with:
@@ -45,7 +45,7 @@ jobs:
45
45
  env:
46
46
  PUPPET_VERSION: ${{ matrix.puppet }}
47
47
  steps:
48
- - uses: actions/checkout@v5
48
+ - uses: actions/checkout@v6
49
49
  - name: Install Ruby ${{ matrix.ruby }}
50
50
  uses: ruby/setup-ruby@v1
51
51
  with:
data/.rubocop.yml CHANGED
@@ -6,6 +6,3 @@ inherit_gem:
6
6
 
7
7
  Metrics:
8
8
  Enabled: false
9
-
10
- AllCops:
11
- TargetRubyVersion: 3.2
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --no-auto-gen-timestamp`
3
- # using RuboCop version 1.79.2.
3
+ # using RuboCop version 1.81.7.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -59,12 +59,17 @@ RSpec/DescribeClass:
59
59
  - '**/spec/views/**/*'
60
60
  - 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
61
61
 
62
- # Offense count: 7
62
+ # Offense count: 8
63
63
  # Configuration parameters: CountAsOne.
64
64
  RSpec/ExampleLength:
65
65
  Max: 17
66
66
 
67
- # Offense count: 31
67
+ # Offense count: 6
68
+ RSpec/LeakyLocalVariable:
69
+ Exclude:
70
+ - 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
71
+
72
+ # Offense count: 32
68
73
  # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
69
74
  # SupportedStyles: always, named_only
70
75
  RSpec/NamedSubject:
@@ -79,8 +84,8 @@ RSpec/RepeatedDescription:
79
84
  - 'spec/puppet-syntax/templates_spec.rb'
80
85
 
81
86
  # Offense count: 4
82
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
83
- # Include: **/*_spec.rb
87
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
88
+ # SupportedInflectors: default, active_support
84
89
  RSpec/SpecFilePathFormat:
85
90
  Exclude:
86
91
  - '**/spec/routing/**/*'
@@ -164,7 +169,7 @@ Style/SymbolProc:
164
169
  - 'lib/puppet-syntax/manifests.rb'
165
170
  - 'lib/puppet-syntax/templates.rb'
166
171
 
167
- # Offense count: 4
172
+ # Offense count: 5
168
173
  # This cop supports safe autocorrection (--autocorrect).
169
174
  # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
170
175
  # URISchemes: http, https
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [v7.1.0](https://github.com/voxpupuli/puppet-syntax/tree/v7.1.0) (2026-02-13)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v7.0.1...v7.1.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - feature: add support for multiple encoded blocks [\#209](https://github.com/voxpupuli/puppet-syntax/pull/209) ([aba-lrettler](https://github.com/aba-lrettler))
12
+
5
13
  ## [v7.0.1](https://github.com/voxpupuli/puppet-syntax/tree/v7.0.1) (2025-08-14)
6
14
 
7
15
  [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v7.0.0...v7.0.1)
data/README.md CHANGED
@@ -15,10 +15,10 @@ Hiera YAML.
15
15
 
16
16
  Puppet::Syntax is supported with:
17
17
 
18
- - Puppet >= 7.0
19
- - Ruby >= 2.7
18
+ - OpenVox >= 8.0
19
+ - Ruby >= 3.2
20
20
 
21
- For the specific versions that we test against, see the [GitHub Actions workflow](.github/workflows/test.yml).
21
+ For the specific versions that we test against, see the [GitHub Actions workflow](.github/workflows/test.yml) or the [Gem spec](puppet-syntax.gemspec).
22
22
 
23
23
  ## Installation
24
24
 
@@ -31,7 +31,7 @@ the gem manually.
31
31
  gem 'puppet-syntax'
32
32
  ```
33
33
 
34
- And then execute:
34
+ And then execute:
35
35
 
36
36
  ```sh
37
37
  bundle install
@@ -113,7 +113,7 @@ task :test => [
113
113
 
114
114
  * To test all manifests and templates, relative to the location of the `Rakefile`, run:
115
115
 
116
- ```
116
+ ```shell
117
117
  $ bundle exec rake syntax
118
118
  ---> syntax:manifests
119
119
  ---> syntax:templates
@@ -122,7 +122,7 @@ $ bundle exec rake syntax
122
122
 
123
123
  * To return a non-zero exit code and an error message on any failures, run:
124
124
 
125
- ```
125
+ ```shell
126
126
  $ bundle exec rake syntax
127
127
  ---> syntax:manifests
128
128
  rake aborted!
@@ -149,14 +149,14 @@ By default, this rake task looks for all `.yaml` files in a single module under:
149
149
  It will validate the syntax of each Hiera *key*. for values, it will check if
150
150
  the interpolation function syntax is correct. Wrong:
151
151
 
152
- ```
152
+ ```yaml
153
153
  foo:
154
154
  "%{lookup('baz'):3306}": []
155
155
  ```
156
156
 
157
157
  correct would be:
158
158
 
159
- ```
159
+ ```yaml
160
160
  foo:
161
161
  "%{lookup('baz')}:3306": []
162
162
  ```
@@ -53,29 +53,37 @@ module PuppetSyntax
53
53
  end
54
54
 
55
55
  def check_eyaml_blob(val)
56
- return unless /^ENC\[/.match?(val)
57
-
58
- val.sub!('ENC[', '')
56
+ # strip newlines and extra spaces
59
57
  val.gsub!(/\s+/, '')
60
- return 'has unterminated eyaml value' unless /\]$/.match?(val)
61
58
 
62
- val.sub!(/\]$/, '')
63
- method, base64 = val.split(',')
64
- if base64.nil?
65
- base64 = method
66
- method = 'PKCS7'
67
- end
59
+ encodes_length = val.scan('ENC[').length
60
+
61
+ # Return if there's no encoded material
62
+ return if encodes_length == 0
63
+
64
+ found_encodes = val.scan(/ENC\[([^,\]]+,)?([^\]]+)?\]/)
65
+
66
+ return 'has unterminated eyaml value' unless found_encodes.length == encodes_length
68
67
 
69
68
  known_methods = %w[PKCS7 GPG GKMS KMS TWOFAC SecretBox VAULT GCPKMS RSA SSHAGENT VAULT_RS cli]
70
- return "has unknown eyaml method #{method}" unless known_methods.include? method
71
- return 'has unpadded or truncated base64 data' unless base64.length % 4 == 0
72
69
 
73
- # Base64#decode64 will silently ignore characters outside the alphabet,
74
- # so we check resulting length of binary data instead
75
- pad_length = base64.gsub(/[^=]/, '').length
76
- return unless Base64.decode64(base64).length != (base64.length * 3 / 4) - pad_length
70
+ found_encodes.each do |match|
71
+ # if no method is found we use the default PKCS7 method
72
+ method = match[0]
73
+ method = +'PKCS7' if method.nil?
74
+ method.delete_suffix!(',')
75
+ base64 = match[1]
77
76
 
78
- 'has corrupt base64 data'
77
+ return 'has invalid eyaml encoded format' if base64.nil?
78
+
79
+ return "has unknown eyaml method #{method}" unless known_methods.include? method
80
+
81
+ return 'has unpadded or truncated base64 data' unless base64.length % 4 == 0
82
+
83
+ return 'has corrupt base64 data' unless base64.match?(%r{^[a-zA-Z0-9+/=]+$})
84
+ end
85
+ # all good
86
+ nil
79
87
  end
80
88
 
81
89
  def check(filelist)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetSyntax
4
- VERSION = '7.0.1'
4
+ VERSION = '7.1.0'
5
5
  end
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'openvox', '>= 8', '< 9'
24
24
  spec.add_dependency 'rake', '~> 13.1'
25
25
 
26
- spec.add_development_dependency 'voxpupuli-rubocop', '~> 4.2.0'
26
+ spec.add_development_dependency 'voxpupuli-rubocop', '~> 5.1.0'
27
27
  end
@@ -1,11 +1,11 @@
1
1
  ---
2
- acme::warning1: ENC[unknown-method,aGVsbG8sIHdvcmxk]
3
- acme::warning2: ENC[PKCS7,aGVsbG8sIHdvcmxk
4
- acme::warning3: ENC[PKCS7,aGVsbG8sIHdvcmxk==]
5
- acme::warning4: ENC[PKCS7,aGVs!!!!bG8sIHdvcmxk]
2
+ acme::warning1: ENC[unknown-method,aGVsbG8sIHdvcmxk] # unknown method
3
+ acme::warning2: ENC[PKCS7,aGVsbG8sIHdvcmxk # has unterminated eyaml value
4
+ acme::warning3: ENC[PKCS7,aGVsbG8sIHdvcmxk==] # unpadded or truncated base64 data
5
+ acme::warning4: ENC[PKCS7,aGVsbG8sf&IHdvcmxk==] # corrupt base64 data
6
6
  acme::warning5:
7
7
  key1: foo
8
- key2: ENC[PKCS7,aGVs!!!!bG8sIHdvcmxk]
8
+ key2: ENC[PKCS7,aGVs!!!!bG8sIHdvcmxk] # corrupt base64 data
9
9
  acme::warning6:
10
10
  hash_key:
11
11
  - element1
@@ -17,8 +17,9 @@ acme::warning6:
17
17
  ENC[PKCS7,
18
18
  aGVs!!!!bG8sIHdvcmxk
19
19
  ]
20
- acme::good1: >
21
- ENC[PKCS7,
22
- aGVsbG8sIHdvcmxk]
23
- acme::good2: ENC[GPG,aGVsbG8sIHdvcmxkIQ==]
24
- acme::good3: ENC[GPG,aGVsbG8sIHdvcmxkISE=]
20
+ # corrupt base64 data
21
+ acme::warning7: ENC[] # has invalid eyaml encoded format
22
+ acme::warning8: ENC[PKCS7,aGV&&&sbG8sIHdvcmxk] # unpadded or truncated base64 data
23
+ acme::warning9: | # has unterminated eyaml value
24
+ ENC[aGVsbG8sIHdvcmxk
25
+ ENC[aGVsbG8sIHdvcmxk]
@@ -0,0 +1,13 @@
1
+ ---
2
+ acme::good1: ENC[KMS,aGVsbG8sIdGHdvcmxk==]
3
+ acme::good2: ENC[PKCS7,aGVsbG8sf3IHdvcmxk==]
4
+ acme::good3: ENC[KMS,aGVsbG8sIdGHdvcmxk==]ENC[KMS,aGVsbG8sIdGHdvcmxk==]
5
+ acme::good4: >
6
+ ENC[PKCS7,
7
+ aGVsbG8sIHdvcmxk]
8
+ acme::good5: ENC[GPG,aGVsbG8sIHdvcmxkIQ==]
9
+ acme::good6: ENC[GPG,aGVsbG8sIHdvcmxkISE=]
10
+ acme::good7: |
11
+ text
12
+ ENC[GPG,aGVsbG8sIHdvcmxkISE=]
13
+ acme::good8: ENC[aGVsbG8sf3IHdvcmxk==]
@@ -71,9 +71,15 @@ describe PuppetSyntax::Hiera do
71
71
  expect(res[2]).to match('Key :this_is::warning3: string after a function call but before `}` in the value')
72
72
  end
73
73
 
74
+ it 'returns nothing for good eyaml' do
75
+ files = fixture_hiera('hiera_good.eyaml')
76
+ res = subject.check(files)
77
+ expect(res).to eq []
78
+ end
79
+
74
80
  it 'returns warnings for bad eyaml values' do
75
81
  hiera_yaml = 'hiera_bad.eyaml'
76
- examples = 6
82
+ examples = 9
77
83
  files = fixture_hiera(hiera_yaml)
78
84
  res = subject.check(files)
79
85
  (1..examples).each do |n|
@@ -86,6 +92,9 @@ describe PuppetSyntax::Hiera do
86
92
  expect(res[3]).to match('Key acme::warning4 has corrupt base64 data')
87
93
  expect(res[4]).to match('Key acme::warning5\[\'key2\'\] has corrupt base64 data')
88
94
  expect(res[5]).to match('Key acme::warning6\[\'hash_key\'\]\[2\] has corrupt base64 data')
95
+ expect(res[6]).to match('Key acme::warning7 has invalid eyaml encoded format')
96
+ expect(res[7]).to match('Key acme::warning8 has unpadded or truncated base64 data')
97
+ expect(res[8]).to match('Key acme::warning9 has unterminated eyaml value')
89
98
  end
90
99
 
91
100
  it 'handles empty files' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-syntax
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -49,14 +49,14 @@ dependencies:
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: 4.2.0
52
+ version: 5.1.0
53
53
  type: :development
54
54
  prerelease: false
55
55
  version_requirements: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: 4.2.0
59
+ version: 5.1.0
60
60
  description: Syntax checks for Puppet manifests and templates
61
61
  email:
62
62
  - voxpupuli@groups.io
@@ -92,6 +92,7 @@ files:
92
92
  - spec/fixtures/hiera/hiera_bad.yaml
93
93
  - spec/fixtures/hiera/hiera_badkey.yaml
94
94
  - spec/fixtures/hiera/hiera_badvalue.yaml
95
+ - spec/fixtures/hiera/hiera_good.eyaml
95
96
  - spec/fixtures/hiera/hiera_good.yaml
96
97
  - spec/fixtures/hiera/hiera_key_empty.yaml
97
98
  - spec/fixtures/hiera/hiera_key_no_value.yaml
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
139
  - !ruby/object:Gem::Version
139
140
  version: '0'
140
141
  requirements: []
141
- rubygems_version: 3.6.9
142
+ rubygems_version: 4.0.3
142
143
  specification_version: 4
143
144
  summary: Syntax checks for Puppet manifests, templates, and Hiera YAML
144
145
  test_files: []