Skip to content

Commit 0e53e94

Browse files
committed
eyaml: manage /etc/eyaml/config.yaml when creating keys
If $create_keys is true, then this class now manages the systemwide eyaml configuration file. https://github.com/voxpupuli/hiera-eyaml/?tab=readme-ov-file#configuration-file-for-eyaml
1 parent 00bf69c commit 0e53e94

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

manifests/eyaml.pp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,28 @@
7777
mode => '0644',
7878
require => Exec['createkeys'],
7979
}
80+
81+
file { '/etc/eyaml':
82+
ensure => directory,
83+
owner => 'root',
84+
group => 'root',
85+
mode => '0755',
86+
}
87+
88+
file { '/etc/eyaml/config.yaml':
89+
ensure => file,
90+
owner => 'root',
91+
group => 'root',
92+
mode => '0644',
93+
# https://github.com/voxpupuli/puppet-lint-strict_indent-check/issues/20
94+
# lint:ignore:strict_indent
95+
content => @("CONF"),
96+
---
97+
# This file is managed by puppet.
98+
pkcs7_private_key: ${privkey}
99+
pkcs7_public_key: ${pubkey}
100+
| CONF
101+
# lint:endignore
102+
}
80103
}
81104
}

spec/classes/hiera_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@
8484
it { is_expected.to contain_exec('createkeys').that_requires('Hiera::Install[eyaml]') }
8585
it { is_expected.to contain_file('/dev/null/keys/private_key.pkcs7.pem').with_ensure('file').with_mode('0600').that_requires('Exec[createkeys]') }
8686
it { is_expected.to contain_file('/dev/null/keys/public_key.pkcs7.pem').with_ensure('file').with_mode('0644').that_requires('Exec[createkeys]') }
87+
88+
it do
89+
is_expected.to contain_file('/etc/eyaml/config.yaml').
90+
with_ensure('file').
91+
with_content(%r{pkcs7_private_key: /dev/null/keys/private_key.pkcs7.pem}).
92+
with_content(%r{pkcs7_public_key: /dev/null/keys/public_key.pkcs7.pem})
93+
end
8794
end
8895

8996
describe 'other_backends' do

0 commit comments

Comments
 (0)