beaker-hiera 0.5.0 → 1.0.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: 6fa301c34061f47569899cb912a65ef2445800aa858aeb73bd409a2c458b9032
4
- data.tar.gz: 3b9fe6eefd16dcee3a9ddfc40c157047b832e870728ef8c14996e37566102cd3
3
+ metadata.gz: b27d17635f579df615e3fdf6aa4cb1ad23505caca158d34bb9c30b13b3b1f831
4
+ data.tar.gz: c18828b952f9489fa26b7edc266d2caae232f118854a424fd22fc8f7680e03a8
5
5
  SHA512:
6
- metadata.gz: 2cbb692a5db729f93a2564a46cdaa756cb703698ef864eec4e0e596101092b02b70def1b09b228894e30c6ed329c22220132249a80b59b21d1e6e57bc1f9c35e
7
- data.tar.gz: dd46816d6f16cb699db0413d17d514494ef0c9cbfea3757f8af6dd69fb8ee86a17b9e29297a5d8ddd219911997e9e4c5d75c5bdf20fe5fce50ec1c85f69b5667
6
+ metadata.gz: 7d6b9812852ebd39d41970851225376dba1a6349ddf7ba60272836739ebcd32d77720bea1fe24302acf62cbbf533169fd35db05bff0b33852806020a99cf8303
7
+ data.tar.gz: a00341b48d51817fe42642046a86080e376b9a97e1ea25a786f00a3e92622c639e85c58e2768467b85622760f530c4d0bca41e2048a0aa3e4da656d8e7a1c65d
@@ -1,22 +1,32 @@
1
1
  name: Release
2
2
 
3
3
  on:
4
- create:
5
- ref_type: tag
4
+ push:
5
+ tags:
6
+ - '*'
6
7
 
7
8
  jobs:
8
9
  release:
9
10
  runs-on: ubuntu-latest
10
- if: github.repository == 'voxpupuli/beaker-hiera'
11
+ if: github.repository_owner == 'voxpupuli'
11
12
  steps:
12
- - uses: actions/checkout@v3
13
- - name: Install Ruby 2.7
13
+ - uses: actions/checkout@v4
14
+ - name: Install Ruby 3.0
14
15
  uses: ruby/setup-ruby@v1
15
16
  with:
16
- ruby-version: '2.7'
17
+ ruby-version: '3.0'
18
+ env:
19
+ BUNDLE_WITHOUT: release:development:rubocop
17
20
  - name: Build gem
18
21
  run: gem build *.gemspec
19
- - name: Publish gem
22
+ - name: Publish gem to rubygems.org
20
23
  run: gem push *.gem
21
24
  env:
22
25
  GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
26
+ - name: Setup GitHub packages access
27
+ run: |
28
+ mkdir -p ~/.gem
29
+ echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
30
+ chmod 0600 ~/.gem/credentials
31
+ - name: Publish gem to GitHub packages
32
+ run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
@@ -13,7 +13,7 @@ jobs:
13
13
  rubocop:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v3
16
+ - uses: actions/checkout@v4
17
17
  - name: Install Ruby ${{ matrix.ruby }}
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
@@ -36,7 +36,7 @@ jobs:
36
36
  COVERAGE: ${{ matrix.coverage }}
37
37
  name: RSpec - Ruby ${{ matrix.ruby }}
38
38
  steps:
39
- - uses: actions/checkout@v3
39
+ - uses: actions/checkout@v4
40
40
  - name: Install Ruby ${{ matrix.ruby }}
41
41
  uses: ruby/setup-ruby@v1
42
42
  with:
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  inherit_from: .rubocop_todo.yml
3
3
 
4
+
4
5
  inherit_gem:
5
- beaker: rubocop.yml
6
+ voxpupuli-rubocop: rubocop.yml
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-03-27 16:34:12 UTC using RuboCop version 1.48.1.
3
+ # on 2023-05-05 10:34:45 UTC using RuboCop version 1.50.2.
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
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0](https://github.com/voxpupuli/beaker-hiera/tree/1.0.0) (2023-11-03)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker-hiera/compare/0.6.0...1.0.0)
6
+
7
+ **Breaking changes:**
8
+
9
+ - Convert to Hiera 5 [\#17](https://github.com/voxpupuli/beaker-hiera/pull/17) ([ekohl](https://github.com/ekohl))
10
+
11
+ ## [0.6.0](https://github.com/voxpupuli/beaker-hiera/tree/0.6.0) (2023-05-05)
12
+
13
+ [Full Changelog](https://github.com/voxpupuli/beaker-hiera/compare/0.5.0...0.6.0)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - GCG: Add faraday-retry dep [\#26](https://github.com/voxpupuli/beaker-hiera/pull/26) ([bastelfreak](https://github.com/bastelfreak))
18
+ - switch to voxpupuli-rubocop and cleanup gemspec [\#25](https://github.com/voxpupuli/beaker-hiera/pull/25) ([bastelfreak](https://github.com/bastelfreak))
19
+ - Update release workflow for Vox Pupuli standard [\#24](https://github.com/voxpupuli/beaker-hiera/pull/24) ([bastelfreak](https://github.com/bastelfreak))
20
+
3
21
  ## [0.5.0](https://github.com/voxpupuli/beaker-hiera/tree/0.5.0) (2023-03-28)
4
22
 
5
23
  [Full Changelog](https://github.com/voxpupuli/beaker-hiera/compare/0.4.0...0.5.0)
@@ -14,7 +32,6 @@
14
32
 
15
33
  **Merged pull requests:**
16
34
 
17
- - Bump actions/checkout from 2 to 3 [\#23](https://github.com/voxpupuli/beaker-hiera/pull/23) ([dependabot[bot]](https://github.com/apps/dependabot))
18
35
  - Implement rubocop & fix violations [\#22](https://github.com/voxpupuli/beaker-hiera/pull/22) ([bastelfreak](https://github.com/bastelfreak))
19
36
  - dependabot: check for github actions and gems [\#21](https://github.com/voxpupuli/beaker-hiera/pull/21) ([bastelfreak](https://github.com/bastelfreak))
20
37
 
data/Gemfile CHANGED
@@ -3,5 +3,6 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :release do
6
+ gem 'faraday-retry', require: false
6
7
  gem 'github_changelog_generator', require: false
7
8
  end
data/README.md CHANGED
@@ -2,12 +2,32 @@
2
2
 
3
3
  Beaker Hiera DSL Extension Library! This allows to easily use Hiera data in acceptance tests.
4
4
 
5
+ ## Usage
6
+
7
+ The `write_hiera_config_on` method is the most important one.
8
+ It writes the `hiera.yaml` file to the specified host or hosts.
9
+ The version is always set to 5, as well as a default `datadir`.
10
+ The `hierarchy` is directly what the [documentation](https://www.puppet.com/docs/puppet/7/hiera_config_yaml_5.html) specifies.
11
+ It is then important to also copy the data from a local directory to the same host or hosts.
12
+
5
13
  ```ruby
6
14
  hierarchy = [
7
- 'fqdn/%{fqdn}.yaml',
8
- 'os/%{os.family}/%{os.release.major}.yaml',
9
- 'os/%{os.family}.yaml',
10
- 'common.yaml',
15
+ {
16
+ 'name' => 'Per-node data',
17
+ 'path' => 'fqdn/%{facts.networking.fqdn}.yaml',
18
+ },
19
+ {
20
+ 'name' => 'OS family version data',
21
+ 'path' => 'family/%{facts.os.family}/%{facts.os.release.major}.yaml',
22
+ },
23
+ {
24
+ 'name' => 'OS family data',
25
+ 'path' => 'family/%{facts.os.family}.yaml',
26
+ },
27
+ {
28
+ 'name' => 'Common data',
29
+ 'path' => 'common.yaml',
30
+ },
11
31
  ]
12
32
  write_hiera_config_on(host, hierarchy)
13
33
  copy_hiera_data_to(host, 'spec/acceptance/hieradata')
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ rescue LoadError
22
22
  # github_changelog_generator is an optional release
23
23
  else
24
24
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
25
- config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
25
+ config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog github_actions]
26
26
  config.user = 'voxpupuli'
27
27
  config.project = 'beaker-hiera'
28
28
  gem_version = Gem::Specification.load("#{config.project}.gemspec").version
data/beaker-hiera.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.homepage = 'https://github.com/voxpupuli/beaker-hiera'
10
10
  s.summary = 'Hiera DSL Helpers!'
11
11
  s.description = 'For use for the Beaker acceptance testing tool'
12
- s.license = 'Apache2'
12
+ s.license = 'Apache-2.0'
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
@@ -21,16 +21,8 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'pry', '~> 0.10'
22
22
  s.add_development_dependency 'rake', '~> 13.0'
23
23
  s.add_development_dependency 'rspec', '~> 3.0'
24
- s.add_development_dependency 'rubocop', '~> 1.48.1'
25
- s.add_development_dependency 'rubocop-performance', '~> 1.10'
26
- s.add_development_dependency 'rubocop-rake', '~> 0.2'
27
- s.add_development_dependency 'rubocop-rspec', '>= 1.44'
28
- s.add_development_dependency 'simplecov'
29
-
30
- # Documentation dependencies
31
- s.add_development_dependency 'markdown'
32
- s.add_development_dependency 'thin'
33
- s.add_development_dependency 'yard'
24
+ s.add_development_dependency 'simplecov', '~> 0.22.0'
25
+ s.add_development_dependency 'voxpupuli-rubocop', '~> 1.2'
34
26
 
35
27
  # Run time dependencies
36
28
  s.add_runtime_dependency 'beaker', '>= 4', '< 6'
@@ -9,17 +9,19 @@ module Beaker
9
9
  # @param [Host, Array<Host>, String, Symbol] host
10
10
  # One or more hosts to act upon, or a role (String or Symbol) that
11
11
  # identifies one or more hosts.
12
- # @param [Array] hierarchy
13
- # One or more hierarchy paths
12
+ # @param [Array[Hash[String, String]]] hierarchy
13
+ # The hierachy as specified in Hiera config YAML version 5
14
+ #
15
+ # @see https://www.puppet.com/docs/puppet/7/hiera_config_yaml_5.html
14
16
  def write_hiera_config_on(host, hierarchy)
15
17
  block_on host do |hst|
16
18
  hiera_config = {
17
- backends: 'yaml',
18
- yaml: {
19
- datadir: hiera_datadir(hst),
19
+ 'version' => 5,
20
+ 'defaults' => {
21
+ 'datadir' => hiera_datadir(hst),
22
+ 'data_hash' => 'yaml_data',
20
23
  },
21
- hierarchy: hierarchy,
22
- logger: 'console',
24
+ 'hierarchy' => hierarchy,
23
25
  }
24
26
  create_remote_file hst, hst.puppet['hiera_config'], hiera_config.to_yaml
25
27
  end
@@ -4,7 +4,7 @@ module Beaker
4
4
  module Hiera
5
5
  module Version
6
6
  # Current version of beaker-hiera
7
- STRING = '0.5.0'.freeze
7
+ STRING = '1.0.0'.freeze
8
8
  end
9
9
  end
10
10
  end
@@ -19,7 +19,7 @@ describe ClassMixedWithDSLHelpers do
19
19
  end
20
20
 
21
21
  describe '#write_hiera_config_on' do
22
- let(:hierarchy) { ['nodes/%{::fqdn}', 'common'] }
22
+ let(:hierarchy) { [{ 'name' => 'common', 'path' => 'common.yaml' }] }
23
23
 
24
24
  it 'on host' do
25
25
  expect(subject).to receive(:create_remote_file).with(host, '/usr/face', %r{datadir: "/usr/code/hieradata"})
@@ -28,7 +28,7 @@ describe ClassMixedWithDSLHelpers do
28
28
  end
29
29
 
30
30
  describe '#write_hiera_config' do
31
- let(:hierarchy) { ['nodes/%{::fqdn}', 'common'] }
31
+ let(:hierarchy) { [{ 'name' => 'common', 'path' => 'common.yaml' }] }
32
32
 
33
33
  it 'delegates to #write_hiera_config_on with the default host' do
34
34
  expect(subject).to receive(:default).and_return(host)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-hiera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-28 00:00:00.000000000 Z
12
+ date: 2023-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -54,117 +54,33 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '3.0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rubocop
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: 1.48.1
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: 1.48.1
70
- - !ruby/object:Gem::Dependency
71
- name: rubocop-performance
57
+ name: simplecov
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
60
  - - "~>"
75
61
  - !ruby/object:Gem::Version
76
- version: '1.10'
62
+ version: 0.22.0
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
67
  - - "~>"
82
68
  - !ruby/object:Gem::Version
83
- version: '1.10'
69
+ version: 0.22.0
84
70
  - !ruby/object:Gem::Dependency
85
- name: rubocop-rake
71
+ name: voxpupuli-rubocop
86
72
  requirement: !ruby/object:Gem::Requirement
87
73
  requirements:
88
74
  - - "~>"
89
75
  - !ruby/object:Gem::Version
90
- version: '0.2'
76
+ version: '1.2'
91
77
  type: :development
92
78
  prerelease: false
93
79
  version_requirements: !ruby/object:Gem::Requirement
94
80
  requirements:
95
81
  - - "~>"
96
82
  - !ruby/object:Gem::Version
97
- version: '0.2'
98
- - !ruby/object:Gem::Dependency
99
- name: rubocop-rspec
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '1.44'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: '1.44'
112
- - !ruby/object:Gem::Dependency
113
- name: simplecov
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: markdown
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '0'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
- - !ruby/object:Gem::Dependency
141
- name: thin
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- version: '0'
147
- type: :development
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- version: '0'
154
- - !ruby/object:Gem::Dependency
155
- name: yard
156
- requirement: !ruby/object:Gem::Requirement
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- version: '0'
161
- type: :development
162
- prerelease: false
163
- version_requirements: !ruby/object:Gem::Requirement
164
- requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- version: '0'
83
+ version: '1.2'
168
84
  - !ruby/object:Gem::Dependency
169
85
  name: beaker
170
86
  requirement: !ruby/object:Gem::Requirement
@@ -215,7 +131,7 @@ files:
215
131
  - spec/spec_helper.rb
216
132
  homepage: https://github.com/voxpupuli/beaker-hiera
217
133
  licenses:
218
- - Apache2
134
+ - Apache-2.0
219
135
  metadata: {}
220
136
  post_install_message:
221
137
  rdoc_options: []
@@ -235,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
151
  - !ruby/object:Gem::Version
236
152
  version: '0'
237
153
  requirements: []
238
- rubygems_version: 3.1.6
154
+ rubygems_version: 3.2.33
239
155
  signing_key:
240
156
  specification_version: 4
241
157
  summary: Hiera DSL Helpers!