|
6 | 6 | let(:facts) { facts } |
7 | 7 | let(:params) { {} } |
8 | 8 |
|
9 | | - case facts[:osfamily] |
| 9 | + case facts[:os]['family'] |
10 | 10 | when 'FreeBSD', 'DragonFly' |
11 | 11 | dns_group = 'bind' |
12 | 12 | etc_dir = '/usr/local/etc' |
|
17 | 17 | puppet_path = '/usr/local/bin/puppet' |
18 | 18 | ssl_dir = '/var/puppet/ssl' |
19 | 19 | else |
20 | | - dns_group = facts[:osfamily] == 'RedHat' ? 'named' : 'bind' |
| 20 | + dns_group = facts[:os]['family'] == 'RedHat' ? 'named' : 'bind' |
21 | 21 | etc_dir = '/etc' |
22 | 22 | puppet_etc_dir = "#{etc_dir}/puppetlabs/puppet" |
23 | 23 | home_dir = '/usr/share/foreman-proxy' |
|
28 | 28 | end |
29 | 29 |
|
30 | 30 | let(:tftp_root) do |
31 | | - case facts[:osfamily] |
| 31 | + case facts[:os]['family'] |
32 | 32 | when 'Debian' |
33 | 33 | '/srv/tftp' |
34 | 34 | when 'FreeBSD', 'DragonFly' |
|
128 | 128 | '---', |
129 | 129 | ":settings_directory: #{etc_dir}/foreman-proxy/settings.d", |
130 | 130 | ":ssl_ca_file: #{ssl_dir}/certs/ca.pem", |
131 | | - ":ssl_certificate: #{ssl_dir}/certs/#{facts[:fqdn]}.pem", |
132 | | - ":ssl_private_key: #{ssl_dir}/private_keys/#{facts[:fqdn]}.pem", |
| 131 | + ":ssl_certificate: #{ssl_dir}/certs/#{facts[:networking]['fqdn']}.pem", |
| 132 | + ":ssl_private_key: #{ssl_dir}/private_keys/#{facts[:networking]['fqdn']}.pem", |
133 | 133 | ':trusted_hosts:', |
134 | | - " - #{facts[:fqdn]}", |
135 | | - ":foreman_url: https://#{facts[:fqdn]}", |
| 134 | + " - #{facts[:networking]['fqdn']}", |
| 135 | + ":foreman_url: https://#{facts[:networking]['fqdn']}", |
136 | 136 | ":bind_host: '#{bind_host}'", |
137 | 137 | ':https_port: 8443', |
138 | 138 | ':log_file: /var/log/foreman-proxy/proxy.log', |
|
162 | 162 | end |
163 | 163 |
|
164 | 164 | it 'should generate correct dns.yml' do |
165 | | - dns_key = case facts[:osfamily] |
| 165 | + dns_key = case facts[:os]['family'] |
166 | 166 | when 'Debian' |
167 | 167 | '/etc/bind/rndc.key' |
168 | 168 | when 'FreeBSD', 'DragonFly' |
|
200 | 200 | '---', |
201 | 201 | ':dns_server: 127.0.0.1', |
202 | 202 | ":dns_tsig_keytab: #{etc_dir}/foreman-proxy/dns.keytab", |
203 | | - ":dns_tsig_principal: foremanproxy/#{facts[:fqdn]}@EXAMPLE.COM", |
| 203 | + ":dns_tsig_principal: foremanproxy/#{facts[:networking]['fqdn']}@EXAMPLE.COM", |
204 | 204 | ]) |
205 | 205 | end |
206 | 206 |
|
|
214 | 214 | it 'should generate correct puppet_proxy_puppet_api.yml' do |
215 | 215 | verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/puppet_proxy_puppet_api.yml", [ |
216 | 216 | '---', |
217 | | - ":puppet_url: https://#{facts[:fqdn]}:8140", |
| 217 | + ":puppet_url: https://#{facts[:networking]['fqdn']}:8140", |
218 | 218 | ":puppet_ssl_ca: #{ssl_dir}/certs/ca.pem", |
219 | | - ":puppet_ssl_cert: #{ssl_dir}/certs/#{facts[:fqdn]}.pem", |
220 | | - ":puppet_ssl_key: #{ssl_dir}/private_keys/#{facts[:fqdn]}.pem", |
| 219 | + ":puppet_ssl_cert: #{ssl_dir}/certs/#{facts[:networking]['fqdn']}.pem", |
| 220 | + ":puppet_ssl_key: #{ssl_dir}/private_keys/#{facts[:networking]['fqdn']}.pem", |
221 | 221 | ":api_timeout: 30", |
222 | 222 | ]) |
223 | 223 | end |
|
234 | 234 | it 'should generate correct puppetca_http_api.yml' do |
235 | 235 | verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/puppetca_http_api.yml", [ |
236 | 236 | '---', |
237 | | - ":puppet_url: https://#{facts[:fqdn]}:8140", |
| 237 | + ":puppet_url: https://#{facts[:networking]['fqdn']}:8140", |
238 | 238 | ":puppet_ssl_ca: #{ssl_dir}/certs/ca.pem", |
239 | | - ":puppet_ssl_cert: #{ssl_dir}/certs/#{facts[:fqdn]}.pem", |
240 | | - ":puppet_ssl_key: #{ssl_dir}/private_keys/#{facts[:fqdn]}.pem", |
| 239 | + ":puppet_ssl_cert: #{ssl_dir}/certs/#{facts[:networking]['fqdn']}.pem", |
| 240 | + ":puppet_ssl_key: #{ssl_dir}/private_keys/#{facts[:networking]['fqdn']}.pem", |
241 | 241 | ]) |
242 | 242 | end |
243 | 243 |
|
|
300 | 300 | verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/templates.yml", [ |
301 | 301 | '---', |
302 | 302 | ':enabled: false', |
303 | | - ":template_url: http://#{facts[:fqdn]}:8000", |
| 303 | + ":template_url: http://#{facts[:networking]['fqdn']}:8000", |
304 | 304 | ]) |
305 | 305 | end |
306 | 306 |
|
|
595 | 595 | let(:facts) { super().merge(ipaddress_eth0: '192.168.0.2', netmask_eth0: '255.255.255.0') } |
596 | 596 |
|
597 | 597 | let(:nsupdate_pkg) do |
598 | | - case facts[:osfamily] |
| 598 | + case facts[:os]['family'] |
599 | 599 | when 'RedHat' |
600 | 600 | 'bind-utils' |
601 | 601 | when 'FreeBSD', 'DragonFly' |
|
642 | 642 | '---', |
643 | 643 | ':dns_server: 127.0.0.1', |
644 | 644 | ":dns_tsig_keytab: #{etc_dir}/foreman-proxy/dns.keytab", |
645 | | - ":dns_tsig_principal: foremanproxy/#{facts[:fqdn]}@EXAMPLE.COM", |
| 645 | + ":dns_tsig_principal: foremanproxy/#{facts[:networking]['fqdn']}@EXAMPLE.COM", |
646 | 646 | ]) |
647 | 647 | end |
648 | 648 | end |
|
870 | 870 | let(:params) { super().merge(dhcp_interface: 'dhcpif') } |
871 | 871 | let(:facts) { override_facts(super(), networking: {interfaces: {dhcpif: {ip: '192.0.2.1', network: '192.0.2.0', netmask: '255.255.255.0'}}}) } |
872 | 872 |
|
873 | | - case facts[:osfamily] |
| 873 | + case facts[:os]['family'] |
874 | 874 | when 'FreeBSD', 'DragonFly' |
875 | 875 | dhcp_leases = '/var/db/dhcpd/dhcpd.leases' |
876 | 876 | dhcp_config = "#{etc_dir}/dhcpd.conf" |
|
998 | 998 | should contain_file("#{ssl_dir}").with_group('puppet') |
999 | 999 | should contain_file("#{ssl_dir}/private_keys").with_group('puppet') |
1000 | 1000 | should contain_file("#{ssl_dir}/certs/ca.pem").with_group('puppet') |
1001 | | - should contain_file("#{ssl_dir}/certs/#{facts[:fqdn]}.pem").with_group('puppet') |
1002 | | - should contain_file("#{ssl_dir}/private_keys/#{facts[:fqdn]}.pem").with_group('puppet') |
| 1001 | + should contain_file("#{ssl_dir}/certs/#{facts[:networking]['fqdn']}.pem").with_group('puppet') |
| 1002 | + should contain_file("#{ssl_dir}/private_keys/#{facts[:networking]['fqdn']}.pem").with_group('puppet') |
1003 | 1003 | end |
1004 | 1004 |
|
1005 | 1005 | context 'when puppet group is already being managed' do |
|
1023 | 1023 | end |
1024 | 1024 | end |
1025 | 1025 |
|
1026 | | - context 'with foreman::repo included', unless: ['FreeBSD', 'DragonFly'].include?(facts[:operatingsystem]) do |
| 1026 | + context 'with foreman::repo included', unless: ['FreeBSD', 'DragonFly'].include?(facts[:os]['family']) do |
1027 | 1027 | let(:pre_condition) do |
1028 | 1028 | <<-PUPPET |
1029 | 1029 | class { 'foreman::repo': |
|
0 commit comments