Copy iPXE ROMs into /tftpboot

Previously we assumed that they're put there by some external process
(eg this is performed by instack-undercloud in TripleO).

Change-Id: I82ecd63e212b41b80adba2e679fb1d0cb81dbde7
This commit is contained in:
Miles Gould 2016-04-06 19:09:16 +01:00
parent a7e66a34a4
commit 516bb6cc2b
3 changed files with 30 additions and 28 deletions

View File

@ -225,19 +225,23 @@ class ironic::inspector (
content => template('ironic/inspector_ipxe.erb'),
require => Package['ironic-inspector'],
}
$bios_ipxe_file = '/tftpboot/undionly.kpxe'
exec { 'test BIOS iPXE image present':
path => '/bin:/usr/bin',
command => 'exit 1',
unless => "test -f ${bios_ipxe_file}",
}
if $enable_uefi {
$uefi_ipxe_file = '/tftpboot/ipxe.efi'
exec { 'test UEFI iPXE image present':
path => '/bin:/usr/bin',
command => 'exit 1',
unless => "test -f ${uefi_ipxe_file}",
if $::ironic::params::ipxe_rom_dir {
file { '/tftpboot/undionly.kpxe':
ensure => 'present',
source => "${::ironic::params::ipxe_rom_dir}/undionly.kpxe",
backup => false,
seltype => 'tftpdir_t',
}
if $enable_uefi {
file { '/tftpboot/ipxe.efi':
ensure => 'present',
source => "${::ironic::params::ipxe_rom_dir}/ipxe.efi",
backup => false,
seltype => 'tftpdir_t',
}
}
} else {
warning('iPXE ROM source location not set, ensure ROMs are copied into /tftpboot')
}
}

View File

@ -39,6 +39,7 @@ class ironic::params {
$inspector_dnsmasq_service = 'openstack-ironic-inspector-dnsmasq'
$sqlite_package_name = undef
$pymysql_package_name = undef
$ipxe_rom_dir = '/usr/share/ipxe'
$ironic_wsgi_script_path = '/var/www/cgi-bin/ironic'
$ironic_wsgi_script_source = '/usr/lib/python2.7/site-packages/ironic/api/app.wsgi'
}
@ -57,6 +58,7 @@ class ironic::params {
$inspector_dnsmasq_service = 'ironic-inspector-dnsmasq'
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
$ipxe_rom_dir = '/usr/lib/ipxe'
$ironic_wsgi_script_path = '/usr/lib/cgi-bin/ironic'
$ironic_wsgi_script_source = '/usr/lib/python2.7/dist-packages/ironic/api/app.wsgi'
}

View File

@ -130,12 +130,12 @@ describe 'ironic::inspector' do
)
end
it 'should not test for BIOS iPXE image by default' do
is_expected.to_not contain_exec('test BIOS iPXE image present')
it 'should not contain BIOS iPXE image by default' do
is_expected.to_not contain_file('/tftpboot/undionly.kpxe')
end
it 'should not test for UEFI iPXE image by default' do
is_expected.to_not contain_exec('test UEFI iPXE image present')
it 'should not contain UEFI iPXE image by default' do
is_expected.to_not contain_file('/tftpboot/ipxe.efi')
end
context 'when overriding parameters' do
@ -184,20 +184,16 @@ describe 'ironic::inspector' do
/kernel http:\/\/192.168.0.1:8088\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar/
)
end
it 'should test for BIOS iPXE image' do
is_expected.to contain_exec('test BIOS iPXE image present').with(
:path => '/bin:/usr/bin',
:command => 'exit 1',
:unless => 'test -f /tftpboot/undionly.kpxe'
it 'should contain iPXE chainload images' do
is_expected.to contain_file('/tftpboot/undionly.kpxe').with(
'ensure' => 'present',
'backup' => false,
)
end
it 'should test for UEFI iPXE image' do
is_expected.to contain_exec('test UEFI iPXE image present').with(
:path => '/bin:/usr/bin',
:command => 'exit 1',
:unless => 'test -f /tftpboot/ipxe.efi'
it 'should contain iPXE UEFI chainload image' do
is_expected.to contain_file('/tftpboot/ipxe.efi').with(
'ensure' => 'present',
'backup' => false,
)
end
end