hiera-eyaml 4.2.0 → 5.0.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: 9eb7f6a848fd49e92f95073ea457a181427bf20e47ba869515a6510d43cc893d
4
- data.tar.gz: cc69d4fa0b0b197c25cd873b30f6974dd669e136e39525fddd6813b72504010b
3
+ metadata.gz: 932c6b900a2840edbf57d44a00b39e31c337f6c76fd0161c47ed4d49b18463a8
4
+ data.tar.gz: 51ee6c0a95ebfc4bb9af94572451554d6a2390ade43c1b0c4a2f0f18f8df8d99
5
5
  SHA512:
6
- metadata.gz: fe9b09b8ee6c02c20680851b8468336ed4c415987c70c19d1ceb3ec61c97898dbeee0b6cf1df1ad7b807f8797104897d75e497dadb21c52d68614028c9a3bf48
7
- data.tar.gz: e6a29c5b00b2da302a6e621c0bde65809713391aa827a329ee29b890d244d4c75ecc7718f7179b29b0691580a50a2ecff0bdda598a7c00eeb88392fd83238fee
6
+ metadata.gz: 92a37b8e83aa2fcf0e483df040eafba7885d29f5b8179646ca1012f930776c336e4b1327704ff2ae6cf2b3cc0a67d5f432de81539b5698fd92986b05e934a516
7
+ data.tar.gz: 9d44c0788b1cc0eb6c838eefb8d2dd4f4d5a113207d96bdb4e2aef8f20b2a187842f3f5774c298f53e4db4e18dce8117dfe5db70ed2e0d5b7a0dd582470d479f
@@ -0,0 +1,41 @@
1
+ ---
2
+ # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
3
+
4
+ changelog:
5
+ exclude:
6
+ labels:
7
+ - duplicate
8
+ - invalid
9
+ - modulesync
10
+ - question
11
+ - skip-changelog
12
+ - wont-fix
13
+ - wontfix
14
+ - github_actions
15
+
16
+ categories:
17
+ - title: Breaking Changes 🛠
18
+ labels:
19
+ - backwards-incompatible
20
+
21
+ - title: New Features 🎉
22
+ labels:
23
+ - enhancement
24
+
25
+ - title: Bug Fixes 🐛
26
+ labels:
27
+ - bug
28
+ - bugfix
29
+
30
+ - title: Documentation Updates 📚
31
+ labels:
32
+ - documentation
33
+ - docs
34
+
35
+ - title: Dependency Updates ⬆️
36
+ labels:
37
+ - dependencies
38
+
39
+ - title: Other Changes
40
+ labels:
41
+ - "*"
@@ -1,30 +1,106 @@
1
- name: Release
1
+ ---
2
+ name: Gem Release
2
3
 
3
4
  on:
4
5
  push:
5
6
  tags:
6
7
  - '*'
7
8
 
9
+ permissions: {}
10
+
8
11
  jobs:
9
- release:
10
- runs-on: ubuntu-latest
12
+ build-release:
13
+ # Prevent releases from forked repositories
11
14
  if: github.repository_owner == 'voxpupuli'
15
+ name: Build the gem
16
+ runs-on: ubuntu-24.04
12
17
  steps:
13
- - uses: actions/checkout@v4
14
- - name: Install Ruby 3.1
18
+ - uses: actions/checkout@v6
19
+ - name: Install Ruby
15
20
  uses: ruby/setup-ruby@v1
16
21
  with:
17
- ruby-version: '3.1'
22
+ ruby-version: 'ruby'
18
23
  - name: Build gem
19
- run: gem build --strict --verbose *.gemspec
24
+ shell: bash
25
+ run: gem build --verbose *.gemspec
26
+ - name: Upload gem to GitHub cache
27
+ uses: actions/upload-artifact@v6
28
+ with:
29
+ name: gem-artifact
30
+ path: '*.gem'
31
+ retention-days: 1
32
+ compression-level: 0
33
+
34
+ create-github-release:
35
+ needs: build-release
36
+ name: Create GitHub release
37
+ runs-on: ubuntu-24.04
38
+ permissions:
39
+ contents: write # clone repo and create release
40
+ steps:
41
+ - name: Download gem from GitHub cache
42
+ uses: actions/download-artifact@v7
43
+ with:
44
+ name: gem-artifact
45
+ - name: Create Release
46
+ shell: bash
47
+ env:
48
+ GH_TOKEN: ${{ github.token }}
49
+ run: gh release create --repo ${{ github.repository }} ${{ github.ref_name }} --generate-notes *.gem
50
+
51
+ release-to-github:
52
+ needs: build-release
53
+ name: Release to GitHub
54
+ runs-on: ubuntu-24.04
55
+ permissions:
56
+ packages: write # publish to rubygems.pkg.github.com
57
+ steps:
58
+ - name: Download gem from GitHub cache
59
+ uses: actions/download-artifact@v7
60
+ with:
61
+ name: gem-artifact
62
+ - name: Publish gem to GitHub packages
63
+ run: gem push --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
64
+ env:
65
+ GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}
66
+
67
+ release-to-rubygems:
68
+ needs: build-release
69
+ name: Release gem to rubygems.org
70
+ runs-on: ubuntu-24.04
71
+ environment: release # recommended by rubygems.org
72
+ permissions:
73
+ id-token: write # rubygems.org authentication
74
+ steps:
75
+ - name: Download gem from GitHub cache
76
+ uses: actions/download-artifact@v7
77
+ with:
78
+ name: gem-artifact
79
+ - uses: rubygems/configure-rubygems-credentials@v1.0.0
20
80
  - name: Publish gem to rubygems.org
81
+ shell: bash
21
82
  run: gem push *.gem
22
- env:
23
- GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
24
- - name: Setup GitHub packages access
83
+
84
+ release-verification:
85
+ name: Check that all releases are done
86
+ runs-on: ubuntu-24.04
87
+ permissions:
88
+ contents: read # minimal permissions that we have to grant
89
+ needs:
90
+ - create-github-release
91
+ - release-to-github
92
+ - release-to-rubygems
93
+ steps:
94
+ - name: Download gem from GitHub cache
95
+ uses: actions/download-artifact@v7
96
+ with:
97
+ name: gem-artifact
98
+ - name: Install Ruby
99
+ uses: ruby/setup-ruby@v1
100
+ with:
101
+ ruby-version: 'ruby'
102
+ - name: Wait for release to propagate
103
+ shell: bash
25
104
  run: |
26
- mkdir -p ~/.gem
27
- echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
28
- chmod 0600 ~/.gem/credentials
29
- - name: Publish gem to GitHub packages
30
- run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
105
+ gem install rubygems-await
106
+ gem await *.gem
@@ -1,3 +1,4 @@
1
+ ---
1
2
  name: Test
2
3
 
3
4
  on:
@@ -6,16 +7,16 @@ on:
6
7
  branches:
7
8
  - master
8
9
 
9
- env:
10
- BUNDLE_WITHOUT: release
10
+ permissions:
11
+ contents: read
11
12
 
12
13
  jobs:
13
14
  rubocop:
14
15
  env:
15
16
  BUNDLE_WITHOUT: release
16
- runs-on: ubuntu-latest
17
+ runs-on: ubuntu-24.04
17
18
  steps:
18
- - uses: actions/checkout@v4
19
+ - uses: actions/checkout@v6
19
20
  - name: Install Ruby ${{ matrix.ruby }}
20
21
  uses: ruby/setup-ruby@v1
21
22
  with:
@@ -24,7 +25,7 @@ jobs:
24
25
  - name: Run Rubocop
25
26
  run: bundle exec rake rubocop
26
27
  test:
27
- runs-on: ubuntu-latest
28
+ runs-on: ubuntu-24.04
28
29
  strategy:
29
30
  fail-fast: false
30
31
  matrix:
@@ -33,47 +34,64 @@ jobs:
33
34
  - "3.0"
34
35
  - "3.1"
35
36
  - "3.2"
37
+ - "3.3"
38
+ - "3.4"
39
+ - "4.0"
36
40
  - jruby-9.4
37
- puppet:
38
- - "~> 8.0"
39
- - "~> 7.24"
40
- - "https://github.com/puppetlabs/puppet.git#main"
41
+ - jruby-10
42
+ openvox:
43
+ - "~> 8"
44
+ - "~> 7"
45
+ - "https://github.com/OpenVoxProject/puppet.git#main"
41
46
  exclude:
47
+ - ruby: jruby-10
48
+ openvox: "~> 7"
49
+ - ruby: "4.0"
50
+ openvox: "~> 7"
51
+
52
+ - ruby: "3.4"
53
+ openvox: "~> 7"
54
+
42
55
  - ruby: "3.0"
43
- puppet: "~> 8.0"
56
+ openvox: "~> 8"
44
57
  - ruby: "2.7"
45
- puppet: "~> 8.0"
58
+ openvox: "~> 8"
46
59
 
47
60
  - ruby: "3.0"
48
- puppet: "https://github.com/puppetlabs/puppet.git#main"
61
+ openvox: "https://github.com/openvoxproject/puppet.git#main"
49
62
  - ruby: "2.7"
50
- puppet: "https://github.com/puppetlabs/puppet.git#main"
63
+ openvox: "https://github.com/openvoxproject/puppet.git#main"
64
+
51
65
  env:
52
- PUPPET_VERSION: ${{ matrix.puppet }}
66
+ OPENVOX_VERSION: ${{ matrix.openvox }}
53
67
  COVERAGE: ${{ matrix.coverage }}
54
- name: "Ruby ${{ matrix.ruby }} - Puppet ${{ matrix.puppet }}"
68
+ name: "Ruby ${{ matrix.ruby }} - OpenVox ${{ matrix.openvox }}"
55
69
  steps:
56
70
  - name: Enable coverage reporting on Ruby 3.1
57
- if: matrix.puppet == '~> 7.24' && matrix.ruby == '3.1'
71
+ if: matrix.openvox == '~> 7' && matrix.ruby == '3.1'
58
72
  run: echo 'COVERAGE=yes' >> $GITHUB_ENV
59
- - uses: actions/checkout@v4
60
- - name: Install expect
61
- run: sudo apt-get install expect
73
+ - uses: actions/checkout@v6
62
74
  - name: Install Ruby ${{ matrix.ruby }}
63
75
  uses: ruby/setup-ruby@v1
64
76
  with:
65
77
  ruby-version: ${{ matrix.ruby }}
66
78
  bundler-cache: true
79
+ - name: Display Ruby environment
80
+ run: bundle env
67
81
  - name: spec tests
68
82
  run: bundle exec rake features
69
83
  - name: Verify gem builds
70
84
  run: gem build --strict --verbose *.gemspec
71
85
 
72
86
  tests:
87
+ if: always()
73
88
  needs:
74
89
  - rubocop
75
90
  - test
76
- runs-on: ubuntu-latest
91
+ runs-on: ubuntu-24.04
77
92
  name: Test suite
78
93
  steps:
79
- - run: echo Test suite completed
94
+ - name: Decide whether the needed jobs succeeded or failed
95
+ uses: re-actors/alls-green@release/v1
96
+ with:
97
+ jobs: ${{ toJSON(needs) }}
data/.rubocop.yml CHANGED
@@ -6,3 +6,6 @@ inherit_gem:
6
6
 
7
7
  Metrics:
8
8
  Enabled: false
9
+
10
+ Style/IfUnlessModifier:
11
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2024-10-20 14:24:21 UTC using RuboCop version 1.64.1.
2
+ # `rubocop --auto-gen-config --no-auto-gen-timestamp`
3
+ # using RuboCop version 1.75.8.
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
@@ -13,14 +13,6 @@ Layout/CommentIndentation:
13
13
  Exclude:
14
14
  - 'lib/hiera/backend/eyaml/subcommands/help.rb'
15
15
 
16
- # Offense count: 2
17
- # This cop supports safe autocorrection (--autocorrect).
18
- # Configuration parameters: EnforcedStyle.
19
- # SupportedStyles: space, compact, no_space
20
- Layout/SpaceInsideParens:
21
- Exclude:
22
- - 'lib/hiera/backend/eyaml/logginghelper.rb'
23
-
24
16
  # Offense count: 1
25
17
  Lint/DuplicateMethods:
26
18
  Exclude:
@@ -45,23 +37,6 @@ Lint/RescueException:
45
37
  Exclude:
46
38
  - 'lib/hiera/backend/eyaml/subcommand.rb'
47
39
 
48
- # Offense count: 1
49
- Lint/ShadowingOuterLocalVariable:
50
- Exclude:
51
- - 'lib/hiera/backend/eyaml_backend.rb'
52
-
53
- # Offense count: 7
54
- # This cop supports unsafe autocorrection (--autocorrect-all).
55
- # Configuration parameters: AutoCorrect.
56
- Lint/UselessAssignment:
57
- Exclude:
58
- - 'features/support/env.rb'
59
- - 'lib/hiera/backend/eyaml/plugins.rb'
60
- - 'lib/hiera/backend/eyaml/subcommand.rb'
61
- - 'lib/hiera/backend/eyaml/subcommands/unknown_command.rb'
62
- - 'lib/hiera/backend/eyaml/subcommands/version.rb'
63
- - 'lib/hiera/backend/eyaml/utils.rb'
64
-
65
40
  # Offense count: 1
66
41
  # This cop supports unsafe autocorrection (--autocorrect-all).
67
42
  # Configuration parameters: AutoCorrect.
@@ -74,7 +49,7 @@ Lint/UselessMethodDefinition:
74
49
  # Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
75
50
  Lint/Void:
76
51
  Exclude:
77
- - 'lib/hiera/backend/eyaml/parser/token.rb'
52
+ - 'features/support/env.rb'
78
53
 
79
54
  # Offense count: 1
80
55
  Naming/AccessorMethodName:
@@ -107,8 +82,9 @@ Naming/HeredocDelimiterNaming:
107
82
  - 'lib/hiera/backend/eyaml/subcommands/unknown_command.rb'
108
83
 
109
84
  # Offense count: 1
110
- # Configuration parameters: EnforcedStyle, AllowedPatterns.
85
+ # Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
111
86
  # SupportedStyles: snake_case, camelCase
87
+ # ForbiddenIdentifiers: __id__, __send__
112
88
  Naming/MethodName:
113
89
  Exclude:
114
90
  - 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'
@@ -123,7 +99,7 @@ Naming/MethodParameterName:
123
99
  # Offense count: 1
124
100
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
125
101
  # SupportedStyles: snake_case, normalcase, non_integer
126
- # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
102
+ # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
127
103
  Naming/VariableNumber:
128
104
  Exclude:
129
105
  - 'lib/hiera/backend/eyaml/utils.rb'
@@ -169,14 +145,13 @@ Security/YAMLLoad:
169
145
  - 'features/step_definitions/decrypt_steps.rb'
170
146
  - 'lib/hiera/backend/eyaml_backend.rb'
171
147
 
172
- # Offense count: 9
148
+ # Offense count: 8
173
149
  # This cop supports unsafe autocorrection (--autocorrect-all).
174
150
  # Configuration parameters: EnforcedStyle.
175
151
  # SupportedStyles: always, conditionals
176
152
  Style/AndOr:
177
153
  Exclude:
178
154
  - 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'
179
- - 'lib/hiera/backend/eyaml/highlinehelper.rb'
180
155
  - 'lib/hiera/backend/eyaml/logginghelper.rb'
181
156
  - 'lib/hiera/backend/eyaml/subcommand.rb'
182
157
  - 'lib/hiera/backend/eyaml_backend.rb'
@@ -220,7 +195,7 @@ Style/EnvHome:
220
195
 
221
196
  # Offense count: 10
222
197
  # This cop supports safe autocorrection (--autocorrect).
223
- # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
198
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
224
199
  # SupportedStyles: annotated, template, unannotated
225
200
  Style/FormatStringToken:
226
201
  EnforcedStyle: unannotated
@@ -248,22 +223,6 @@ Style/IdenticalConditionalBranches:
248
223
  - 'lib/hiera/backend/eyaml/subcommands/decrypt.rb'
249
224
  - 'lib/hiera/backend/eyaml/subcommands/edit.rb'
250
225
 
251
- # Offense count: 3
252
- # This cop supports safe autocorrection (--autocorrect).
253
- Style/IfUnlessModifier:
254
- Exclude:
255
- - 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'
256
- - 'lib/hiera/backend/eyaml/parser/encrypted_tokens.rb'
257
-
258
- # Offense count: 2
259
- # This cop supports unsafe autocorrection (--autocorrect-all).
260
- # Configuration parameters: AllowedMethods.
261
- # AllowedMethods: nonzero?
262
- Style/IfWithBooleanLiteralBranches:
263
- Exclude:
264
- - 'lib/hiera/backend/eyaml/highlinehelper.rb'
265
- - 'lib/hiera/backend/eyaml_backend.rb'
266
-
267
226
  # Offense count: 1
268
227
  # This cop supports unsafe autocorrection (--autocorrect-all).
269
228
  Style/MapIntoArray:
@@ -408,9 +367,9 @@ Style/ZeroLengthPredicate:
408
367
  Exclude:
409
368
  - 'lib/hiera/backend/eyaml/parser/parser.rb'
410
369
 
411
- # Offense count: 11
370
+ # Offense count: 13
412
371
  # This cop supports safe autocorrection (--autocorrect).
413
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
372
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
414
373
  # URISchemes: http, https
415
374
  Layout/LineLength:
416
375
  Max: 194
data/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [v5.0.0](https://github.com/voxpupuli/hiera-eyaml/tree/v5.0.0) (2026-02-21)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/hiera-eyaml/compare/v4.3.0...v5.0.0)
8
+
9
+ **Breaking changes:**
10
+
11
+ - adjust CLI newline printing to fix output not matching input [\#389](https://github.com/voxpupuli/hiera-eyaml/pull/389) ([bugfood](https://github.com/bugfood))
12
+
13
+ **Implemented enhancements:**
14
+
15
+ - syslog: Allow 0.4 [\#411](https://github.com/voxpupuli/hiera-eyaml/pull/411) ([bastelfreak](https://github.com/bastelfreak))
16
+ - Add Jruby-10 support [\#410](https://github.com/voxpupuli/hiera-eyaml/pull/410) ([bastelfreak](https://github.com/bastelfreak))
17
+ - Add Ruby 4.0 support [\#409](https://github.com/voxpupuli/hiera-eyaml/pull/409) ([bastelfreak](https://github.com/bastelfreak))
18
+ - feat\(\#404\): Accept base64 encoded environment variables as pkcs7 keys [\#405](https://github.com/voxpupuli/hiera-eyaml/pull/405) ([JGodin-C2C](https://github.com/JGodin-C2C))
19
+ - CI: Add Ruby 3.4 support [\#397](https://github.com/voxpupuli/hiera-eyaml/pull/397) ([bastelfreak](https://github.com/bastelfreak))
20
+
21
+ **Fixed bugs:**
22
+
23
+ - Trailing newline is added during encryption/decryption [\#272](https://github.com/voxpupuli/hiera-eyaml/issues/272)
24
+
25
+ **Merged pull requests:**
26
+
27
+ - README: mention that puppet-hiera can manage hiera-eyaml [\#399](https://github.com/voxpupuli/hiera-eyaml/pull/399) ([kenyon](https://github.com/kenyon))
28
+
29
+ ## [v4.3.0](https://github.com/voxpupuli/hiera-eyaml/tree/v4.3.0) (2025-06-05)
30
+
31
+ [Full Changelog](https://github.com/voxpupuli/hiera-eyaml/compare/v4.2.0...v4.3.0)
32
+
33
+ **Implemented enhancements:**
34
+
35
+ - CI: Replace puppet with openvox [\#390](https://github.com/voxpupuli/hiera-eyaml/pull/390) ([bastelfreak](https://github.com/bastelfreak))
36
+ - Add Ruby 3.3 to CI matrix [\#386](https://github.com/voxpupuli/hiera-eyaml/pull/386) ([bastelfreak](https://github.com/bastelfreak))
37
+
38
+ **Merged pull requests:**
39
+
40
+ - voxpupuli-rubocop: Update 2.8.0-\>3.1.0 [\#393](https://github.com/voxpupuli/hiera-eyaml/pull/393) ([bastelfreak](https://github.com/bastelfreak))
41
+
5
42
  ## [v4.2.0](https://github.com/voxpupuli/hiera-eyaml/tree/v4.2.0) (2024-10-21)
6
43
 
7
44
  [Full Changelog](https://github.com/voxpupuli/hiera-eyaml/compare/v4.1.0...v4.2.0)
data/Gemfile CHANGED
@@ -21,15 +21,22 @@ group :development do
21
21
  gem 'aruba', '~> 2.2'
22
22
  gem 'cucumber', '~> 9.2'
23
23
  gem 'hiera-eyaml-plaintext'
24
- gem 'puppet', *location_for(ENV['PUPPET_VERSION']) if ENV['PUPPET_VERSION']
24
+ gem 'openvox', *location_for(ENV['OPENVOX_VERSION']) if ENV['OPENVOX_VERSION']
25
25
  end
26
26
 
27
- group :release do
28
- gem 'faraday-retry', require: false
29
- gem 'github_changelog_generator', require: false
27
+ group :release, optional: true do
28
+ gem 'faraday-retry', '~> 2.1', require: false
29
+ gem 'github_changelog_generator', '~> 1.16.4', require: false
30
30
  end
31
31
 
32
32
  group :coverage, optional: ENV['COVERAGE'] != 'yes' do
33
33
  gem 'codecov', require: false
34
34
  gem 'simplecov-console', require: false
35
35
  end
36
+
37
+ # openvox gem depends on syslog, but doesn't list it as explicit dependency
38
+ # until Ruby 3.4, syslog was part of MRI ruby core
39
+ # https://github.com/OpenVoxProject/puppet/issues/90
40
+ platforms :mri do
41
+ gem 'syslog', '>= 0.3.0', '< 0.5'
42
+ end
data/README.md CHANGED
@@ -65,6 +65,10 @@ files as simple as clear text files.
65
65
  Setup
66
66
  -----
67
67
 
68
+ ### Puppet module
69
+
70
+ The Vox Pupuli [hiera module](https://github.com/voxpupuli/puppet-hiera) can manage the installation and configuration of hiera-eyaml.
71
+
68
72
  ### Installing hiera-eyaml
69
73
 
70
74
  #### RubyGems
@@ -535,7 +539,6 @@ In order to run the tests, simply run `cucumber` in the top level directory of t
535
539
 
536
540
  You'll need to have a few requirements installed:
537
541
 
538
- * `expect` (via yum/apt-get or system package)
539
542
  * `aruba` (gem)
540
543
  * `cucumber` (gem)
541
544
  * `puppet` (gem)
data/Rakefile CHANGED
@@ -26,7 +26,7 @@ end
26
26
  # https://stackoverflow.com/questions/6473419/using-simplecov-to-display-cucumber-code-coverage
27
27
  require 'cucumber/rake/task'
28
28
  Cucumber::Rake::Task.new(:features) do |t|
29
- t.cucumber_opts = %w[--format progress] # Any valid command line option can go here.
29
+ t.cucumber_opts = %w[--format progress --strict] # Any valid command line option can go here.
30
30
  end
31
31
 
32
32
  begin
data/hiera-eyaml.gemspec CHANGED
@@ -16,12 +16,13 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.add_runtime_dependency 'highline', '>= 2.1', '< 4'
20
- gem.add_runtime_dependency 'optimist', '~> 3.1'
19
+ gem.add_dependency 'base64', '~> 0.3.0'
20
+ gem.add_dependency 'highline', '>= 2.1', '< 4'
21
+ gem.add_dependency 'optimist', '~> 3.1'
21
22
 
22
23
  gem.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
23
24
  gem.add_development_dependency 'rspec-expectations', '~> 3.13'
24
- gem.add_development_dependency 'voxpupuli-rubocop', '~> 2.8.0'
25
+ gem.add_development_dependency 'voxpupuli-rubocop', '~> 3.1.0'
25
26
 
26
- gem.required_ruby_version = '>= 2.7', ' < 4'
27
+ gem.required_ruby_version = '>= 2.7', ' < 5'
27
28
  end
@@ -42,7 +42,7 @@ class Hiera
42
42
  executor = Eyaml::Options[:executor]
43
43
 
44
44
  result = executor.execute
45
- puts result unless result.nil?
45
+ executor.print_out(result) unless result.nil?
46
46
  end
47
47
  end
48
48
  end
@@ -1,4 +1,5 @@
1
1
  require 'openssl'
2
+ require 'base64'
2
3
  require 'hiera/backend/eyaml/encryptor'
3
4
  require 'hiera/backend/eyaml/encrypthelper'
4
5
  require 'hiera/backend/eyaml/logginghelper'
@@ -20,6 +21,10 @@ class Hiera
20
21
  type: :string, },
21
22
  public_key_env_var: { desc: 'Name of environment variable to read public key from',
22
23
  type: :string, },
24
+ b64_private_key_env_var: { desc: 'Name of environment variable to read private key from, encoded in base64',
25
+ type: :string, },
26
+ b64_public_key_env_var: { desc: 'Name of environment variable to read public key from, encoded in base64',
27
+ type: :string, },
23
28
  keysize: { desc: 'Key size used for encryption',
24
29
  type: :integer,
25
30
  default: 2048, },
@@ -91,9 +96,10 @@ class Hiera
91
96
  LoggingHelper.info 'Keys created OK'
92
97
  end
93
98
 
94
- def self.load_ANY_key_pem(optname_key, optname_env_var)
99
+ def self.load_ANY_key_pem(optname_key, optname_env_var, b64_optname_env_var)
95
100
  opt_key = option(optname_key.to_sym)
96
101
  opt_key_env_var = option(optname_env_var.to_sym)
102
+ b64_opt_key_env_var = option(b64_optname_env_var.to_sym)
97
103
 
98
104
  if opt_key and opt_key_env_var
99
105
  warn "both #{optname_key} and #{optname_env_var} specified, using #{optname_env_var}"
@@ -103,6 +109,10 @@ class Hiera
103
109
  raise StandardError, "env #{opt_key_env_var} is not set" unless ENV[opt_key_env_var]
104
110
 
105
111
  opt_key_pem = ENV.fetch(opt_key_env_var, nil)
112
+ elsif b64_opt_key_env_var
113
+ raise StandardError, "env #{b64_opt_key_env_var} is not set" unless ENV[b64_opt_key_env_var]
114
+
115
+ opt_key_pem = Base64.decode64(ENV.fetch(b64_opt_key_env_var, nil))
106
116
  elsif opt_key
107
117
  raise StandardError, "file #{opt_key} does not exist" unless File.exist? opt_key
108
118
 
@@ -115,11 +125,11 @@ class Hiera
115
125
  end
116
126
 
117
127
  def self.load_public_key_pem
118
- load_ANY_key_pem('public_key', 'public_key_env_var')
128
+ load_ANY_key_pem('public_key', 'public_key_env_var', 'b64_public_key_env_var')
119
129
  end
120
130
 
121
131
  def self.load_private_key_pem
122
- load_ANY_key_pem('private_key', 'private_key_env_var')
132
+ load_ANY_key_pem('private_key', 'private_key_env_var', 'b64_private_key_env_var')
123
133
  end
124
134
  end
125
135
  end
@@ -1,20 +1,20 @@
1
- require 'highline/import'
1
+ require 'highline'
2
2
 
3
3
  class Hiera
4
4
  module Backend
5
5
  module Eyaml
6
6
  class HighlineHelper
7
+ def self.cli
8
+ HighLine.new($stdin, $stderr)
9
+ end
10
+
7
11
  def self.read_password
8
- ask('Enter password: ') { |q| q.echo = '*' }
12
+ cli.ask('Enter password: ') { |q| q.echo = '*' }
9
13
  end
10
14
 
11
15
  def self.confirm?(message)
12
- result = ask("#{message} (y/N): ")
13
- if result.downcase == 'y' or result.downcase == 'yes'
14
- true
15
- else
16
- false
17
- end
16
+ result = cli.ask("#{message} (y/N): ")
17
+ %w[y yes].include?(result.downcase) || false
18
18
  end
19
19
  end
20
20
  end
@@ -50,7 +50,7 @@ class Hiera
50
50
  if hiera?
51
51
  Hiera.send(hiera_loglevel, message) if threshold.nil? or Eyaml.verbosity_level > threshold
52
52
  elsif threshold.nil? or Eyaml.verbosity_level > threshold
53
- STDERR.puts self.colorize( message, cli_color )
53
+ STDERR.puts self.colorize(message, cli_color)
54
54
  end
55
55
  end
56
56
 
@@ -146,9 +146,7 @@ class Hiera
146
146
 
147
147
  def create_token(string)
148
148
  md = @regex.match(string)
149
- if EncToken.encrypt_unchanged == false && !md[1].nil? && (md[3] == EncToken.tokens_map[md[1]])
150
- return EncToken.plain_text_value(:string, md[3], md[2], string, md[1])
151
- end
149
+ return EncToken.plain_text_value(:string, md[3], md[2], string, md[1]) if EncToken.encrypt_unchanged == false && !md[1].nil? && (md[3] == EncToken.tokens_map[md[1]])
152
150
 
153
151
  EncToken.decrypted_value(:string, md[3], md[2], string, md[1])
154
152
  end
@@ -161,9 +159,7 @@ class Hiera
161
159
 
162
160
  def create_token(string)
163
161
  md = @regex.match(string)
164
- if EncToken.encrypt_unchanged == false && !md[2].nil? && (md[4] == EncToken.tokens_map[md[2]])
165
- return EncToken.plain_text_value(:string, md[4], md[3], string, md[2])
166
- end
162
+ return EncToken.plain_text_value(:string, md[4], md[3], string, md[2]) if EncToken.encrypt_unchanged == false && !md[2].nil? && (md[4] == EncToken.tokens_map[md[2]])
167
163
 
168
164
  EncToken.decrypted_value(:block, md[4], md[3], string, md[2], md[1])
169
165
  end
@@ -5,7 +5,6 @@ class Hiera
5
5
  class TokenType
6
6
  attr_reader :regex
7
7
 
8
- @regex
9
8
  def create_token(_string)
10
9
  raise 'Abstract method called'
11
10
  end
@@ -37,7 +37,6 @@ class Hiera
37
37
  dependency = spec.dependencies.find { |d| d.name == 'hiera-eyaml' }
38
38
  next if dependency && !dependency.requirement.satisfied_by?(this_version)
39
39
 
40
- file = nil
41
40
  file = if gem_version >= Gem::Version.new('1.8.0')
42
41
  spec.matches_for_glob('**/eyaml_init.rb').first
43
42
  else
@@ -86,7 +86,7 @@ class Hiera
86
86
  def self.find(commandname = 'unknown_command')
87
87
  begin
88
88
  require "hiera/backend/eyaml/subcommands/#{commandname.downcase}"
89
- rescue Exception => e
89
+ rescue Exception
90
90
  require 'hiera/backend/eyaml/subcommands/unknown_command'
91
91
  return Hiera::Backend::Eyaml::Subcommands::UnknownCommand
92
92
  end
@@ -135,6 +135,10 @@ class Hiera
135
135
  options
136
136
  end
137
137
 
138
+ def self.print_out(string)
139
+ print string
140
+ end
141
+
138
142
  def self.validate(args)
139
143
  args
140
144
  end
@@ -81,6 +81,17 @@ class Hiera
81
81
  decrypted.join
82
82
  end
83
83
  end
84
+
85
+ def self.print_out(string)
86
+ case Eyaml::Options[:source]
87
+ when :eyaml
88
+ # Be sure the output ends with a newline, since YAML is a text format.
89
+ puts string
90
+ else
91
+ # Print the exact result.
92
+ print string
93
+ end
94
+ end
84
95
  end
85
96
  end
86
97
  end
@@ -90,6 +90,18 @@ class Hiera
90
90
  end
91
91
  end
92
92
  end
93
+
94
+ def self.print_out(string)
95
+ case Eyaml::Options[:output]
96
+ when 'string'
97
+ # Do not include a newline, so that 'eyaml decrypt' of the
98
+ # output returns the original input.
99
+ print string
100
+ else
101
+ # The output is a text file, so ensure there is a final newline.
102
+ puts string
103
+ end
104
+ end
93
105
  end
94
106
  end
95
107
  end
@@ -20,7 +20,6 @@ class Hiera
20
20
  end
21
21
 
22
22
  def self.execute
23
- subcommands = Eyaml.subcommands
24
23
  puts <<~EOS
25
24
  Unknown subcommand#{': ' + Eyaml.subcommand if Eyaml.subcommand}
26
25
 
@@ -15,8 +15,6 @@ class Hiera
15
15
  end
16
16
 
17
17
  def self.execute
18
- plugin_versions = {}
19
-
20
18
  Eyaml::LoggingHelper.info "hiera-eyaml (core): #{Eyaml::VERSION}"
21
19
 
22
20
  Plugins.plugins.each do |plugin|
@@ -60,7 +60,7 @@ class Hiera
60
60
  return string if orig_encoding == Encoding::UTF_8
61
61
 
62
62
  string.dup.force_encoding(Encoding::UTF_8)
63
- rescue EncodingError => e
63
+ rescue EncodingError
64
64
  warn "Unable to encode to \"Encoding::UTF_8\" using the original \"#{orig_encoding}\""
65
65
  string
66
66
  end
@@ -1,7 +1,7 @@
1
1
  class Hiera
2
2
  module Backend
3
3
  module Eyaml
4
- VERSION = '4.2.0'
4
+ VERSION = '5.0.0'
5
5
  DESCRIPTION = 'Hiera-eyaml is a backend for Hiera which provides OpenSSL encryption/decryption for Hiera properties'
6
6
 
7
7
  class RecoverableError < StandardError
@@ -105,7 +105,7 @@ class Hiera
105
105
  end
106
106
 
107
107
  def encrypted?(data)
108
- /.*ENC\[.*\]/.match?(data) ? true : false
108
+ /.*ENC\[.*\]/.match?(data) || false
109
109
  end
110
110
 
111
111
  def parse_answer(data, scope, extra_data = {})
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-eyaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 0.3.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.3.0
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: highline
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -84,14 +97,14 @@ dependencies:
84
97
  requirements:
85
98
  - - "~>"
86
99
  - !ruby/object:Gem::Version
87
- version: 2.8.0
100
+ version: 3.1.0
88
101
  type: :development
89
102
  prerelease: false
90
103
  version_requirements: !ruby/object:Gem::Requirement
91
104
  requirements:
92
105
  - - "~>"
93
106
  - !ruby/object:Gem::Version
94
- version: 2.8.0
107
+ version: 3.1.0
95
108
  description: Hiera backend for decrypting encrypted yaml properties
96
109
  email: voxpupuli@groups.io
97
110
  executables:
@@ -100,6 +113,7 @@ extensions: []
100
113
  extra_rdoc_files: []
101
114
  files:
102
115
  - ".github/dependabot.yml"
116
+ - ".github/release.yml"
103
117
  - ".github/workflows/release.yml"
104
118
  - ".github/workflows/test.yml"
105
119
  - ".gitignore"
@@ -146,7 +160,6 @@ homepage: https://github.com/voxpupuli/hiera-eyaml/
146
160
  licenses:
147
161
  - MIT
148
162
  metadata: {}
149
- post_install_message:
150
163
  rdoc_options: []
151
164
  require_paths:
152
165
  - lib
@@ -157,15 +170,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
170
  version: '2.7'
158
171
  - - "<"
159
172
  - !ruby/object:Gem::Version
160
- version: '4'
173
+ version: '5'
161
174
  required_rubygems_version: !ruby/object:Gem::Requirement
162
175
  requirements:
163
176
  - - ">="
164
177
  - !ruby/object:Gem::Version
165
178
  version: '0'
166
179
  requirements: []
167
- rubygems_version: 3.3.27
168
- signing_key:
180
+ rubygems_version: 4.0.3
169
181
  specification_version: 4
170
182
  summary: OpenSSL Encryption backend for Hiera
171
183
  test_files: []