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 +4 -4
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +2 -2
- data/CHANGELOG.md +8 -1
- data/README.md +24 -4
- data/Rakefile +1 -1
- data/lib/beaker-hiera/helpers.rb +9 -7
- data/lib/beaker-hiera/version.rb +1 -1
- data/spec/beaker-hiera/helpers_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b27d17635f579df615e3fdf6aa4cb1ad23505caca158d34bb9c30b13b3b1f831
|
4
|
+
data.tar.gz: c18828b952f9489fa26b7edc266d2caae232f118854a424fd22fc8f7680e03a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d6b9812852ebd39d41970851225376dba1a6349ddf7ba60272836739ebcd32d77720bea1fe24302acf62cbbf533169fd35db05bff0b33852806020a99cf8303
|
7
|
+
data.tar.gz: a00341b48d51817fe42642046a86080e376b9a97e1ea25a786f00a3e92622c639e85c58e2768467b85622760f530c4d0bca41e2048a0aa3e4da656d8e7a1c65d
|
data/.github/workflows/test.yml
CHANGED
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
rubocop:
|
14
14
|
runs-on: ubuntu-latest
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
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@
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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/lib/beaker-hiera/helpers.rb
CHANGED
@@ -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
|
-
#
|
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
|
-
|
18
|
-
|
19
|
-
datadir
|
19
|
+
'version' => 5,
|
20
|
+
'defaults' => {
|
21
|
+
'datadir' => hiera_datadir(hst),
|
22
|
+
'data_hash' => 'yaml_data',
|
20
23
|
},
|
21
|
-
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
|
data/lib/beaker-hiera/version.rb
CHANGED
@@ -19,7 +19,7 @@ describe ClassMixedWithDSLHelpers do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#write_hiera_config_on' do
|
22
|
-
let(:hierarchy) { [
|
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) { [
|
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.
|
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-
|
12
|
+
date: 2023-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|