beaker-hiera 0.6.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: cb77aa5ce898f9f4722b09efa970d546e19c3e1c4f2d245ce50322cf01522e04
4
- data.tar.gz: d065cefe4ee313132d5728ad657c2da68188ab0fab4c8e63298634c790de1684
3
+ metadata.gz: b27d17635f579df615e3fdf6aa4cb1ad23505caca158d34bb9c30b13b3b1f831
4
+ data.tar.gz: c18828b952f9489fa26b7edc266d2caae232f118854a424fd22fc8f7680e03a8
5
5
  SHA512:
6
- metadata.gz: 463c83684e9f8e2482426874ef7afc35ae91a39086b5fb0a7e71761bd28e6a6c660f1ceeb7bc26f57ed315c1fef351b6ad42ee0b5f0dae893ec0d33142aca703
7
- data.tar.gz: a47500a6d076eef1e25ad994d54de397e51a9525be12892d573fedc433519922b7ff7da31f7a5334b1d6dbf6da47863b0f69eb9ab0b23ea6f795dff186f29dbb
6
+ metadata.gz: 7d6b9812852ebd39d41970851225376dba1a6349ddf7ba60272836739ebcd32d77720bea1fe24302acf62cbbf533169fd35db05bff0b33852806020a99cf8303
7
+ data.tar.gz: a00341b48d51817fe42642046a86080e376b9a97e1ea25a786f00a3e92622c639e85c58e2768467b85622760f530c4d0bca41e2048a0aa3e4da656d8e7a1c65d
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
  if: github.repository_owner == 'voxpupuli'
12
12
  steps:
13
- - uses: actions/checkout@v3
13
+ - uses: actions/checkout@v4
14
14
  - name: Install Ruby 3.0
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
@@ -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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## [0.6.0](https://github.com/voxpupuli/beaker-hiera/tree/0.6.0) (2023-05-05)
4
12
 
5
13
  [Full Changelog](https://github.com/voxpupuli/beaker-hiera/compare/0.5.0...0.6.0)
@@ -24,7 +32,6 @@
24
32
 
25
33
  **Merged pull requests:**
26
34
 
27
- - Bump actions/checkout from 2 to 3 [\#23](https://github.com/voxpupuli/beaker-hiera/pull/23) ([dependabot[bot]](https://github.com/apps/dependabot))
28
35
  - Implement rubocop & fix violations [\#22](https://github.com/voxpupuli/beaker-hiera/pull/22) ([bastelfreak](https://github.com/bastelfreak))
29
36
  - dependabot: check for github actions and gems [\#21](https://github.com/voxpupuli/beaker-hiera/pull/21) ([bastelfreak](https://github.com/bastelfreak))
30
37
 
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
@@ -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.6.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.6.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-05-05 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