From 516bb6cc2bcad5682e360b6ff0c84b4a5ce81c42 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Wed, 6 Apr 2016 19:09:16 +0100 Subject: [PATCH] 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 --- manifests/inspector.pp | 28 +++++++++++++++------------ manifests/params.pp | 2 ++ spec/classes/ironic_inspector_spec.rb | 28 ++++++++++++--------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/manifests/inspector.pp b/manifests/inspector.pp index 6def6a6d..a51de9b3 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -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') } } diff --git a/manifests/params.pp b/manifests/params.pp index 4493e57e..6b875586 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' } diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index f3b5bbc1..a2cea48a 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -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