-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathforeman_proxy__tftp_spec.rb
More file actions
71 lines (63 loc) · 3.09 KB
/
Copy pathforeman_proxy__tftp_spec.rb
File metadata and controls
71 lines (63 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'spec_helper'
describe 'foreman_proxy::tftp' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let :pre_condition do
'include ::foreman_proxy'
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('foreman_proxy::tftp::netboot') }
case facts[:os]['family']
when 'Debian'
tftp_root = '/srv/tftp'
names = {
'/usr/lib/PXELINUX/pxelinux.0' => "#{tftp_root}/pxelinux.0",
'/usr/lib/syslinux/memdisk' => "#{tftp_root}/memdisk",
'/usr/lib/syslinux/modules/bios/chain.c32' => "#{tftp_root}/chain.c32",
'/usr/lib/syslinux/modules/bios/ldlinux.c32' => "#{tftp_root}/ldlinux.c32",
'/usr/lib/syslinux/modules/bios/libcom32.c32' => "#{tftp_root}/libcom32.c32",
'/usr/lib/syslinux/modules/bios/libutil.c32' => "#{tftp_root}/libutil.c32",
'/usr/lib/syslinux/modules/bios/mboot.c32' => "#{tftp_root}/mboot.c32",
'/usr/lib/syslinux/modules/bios/menu.c32' => "#{tftp_root}/menu.c32",
}
when 'FreeBSD', 'DragonFly'
tftp_root = '/tftpboot'
names = {
'/usr/local/share/syslinux/bios/core/pxelinux.0' => "#{tftp_root}/pxelinux.0",
'/usr/local/share/syslinux/bios/memdisk/memdisk' => "#{tftp_root}/memdisk",
'/usr/local/share/syslinux/bios/com32/chain/chain.c32' => "#{tftp_root}/chain.c32",
'/usr/local/share/syslinux/bios/com32/elflink/ldlinux/ldlinux.c32' => "#{tftp_root}/ldlinux.c32",
'/usr/local/share/syslinux/bios/com32/lib/libcom32.c32' => "#{tftp_root}/libcom32.c32",
'/usr/local/share/syslinux/bios/com32/libutil/libutil.c32' => "#{tftp_root}/libutil.c32",
'/usr/local/share/syslinux/bios/com32/mboot/mboot.c32' => "#{tftp_root}/mboot.c32",
'/usr/local/share/syslinux/bios/com32/menu/menu.c32' => "#{tftp_root}/menu.c32",
}
when 'RedHat'
tftp_root = '/var/lib/tftpboot'
names = {
'/usr/share/syslinux/chain.c32' => "#{tftp_root}/chain.c32",
'/usr/share/syslinux/mboot.c32' => "#{tftp_root}/mboot.c32",
'/usr/share/syslinux/menu.c32' => "#{tftp_root}/menu.c32",
'/usr/share/syslinux/memdisk' => "#{tftp_root}/memdisk",
'/usr/share/syslinux/pxelinux.0' => "#{tftp_root}/pxelinux.0",
}
else
tftp_root = ''
names = {}
end
names.each do |source, target|
it { is_expected.to contain_file(target).with_source(source) }
end
it { is_expected.to contain_class('foreman_proxy::tftp::netboot').with_root(tftp_root) }
case facts[:os]['family']
when 'FreeBSD', 'DragonFly'
it { should contain_file("#{tftp_root}/grub2/grub.cfg").with_mode('0644').with_owner('foreman_proxy') }
else
it { should contain_file("#{tftp_root}/grub2/grub.cfg").with_mode('0644').with_owner('foreman-proxy') }
end
end
end
end