Skip to content

Commit

Permalink
Fixes #36940 - Add necessary migration for host_config tftp directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard authored and goarsna committed Aug 5, 2024
1 parent 7e79a3b commit f1b99e6
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if answers['foreman_proxy']
root = answers['foreman_proxy']['tftp_root']
if answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/host-config"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if answers['foreman_proxy']
root = answers['foreman_proxy']['tftp_root']
if answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/bootloader-universe/pxegrub2"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if answers['foreman_proxy']
root = answers['foreman_proxy']['tftp_root']
if answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/host-config"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if answers['foreman_proxy']
root = answers['foreman_proxy']['tftp_root']
if answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/bootloader-universe/pxegrub2"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if answers['foreman_proxy']
root = answers['foreman_proxy']['tftp_root']
if answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/host-config"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if answers['foreman_proxy']
root = answers['foreman_proxy']['tftp_root']
if answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/bootloader-universe/pxegrub2"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require 'spec_helper'

migration '20240531091300_foreman_proxy_tftp_host_config' do
scenarios %w[foreman katello foreman-proxy-content] do
context 'host-config in tftp_dirs missing' do
let(:answers) do
{
'foreman_proxy' => {
'tftp_root' => '/var/lib/tftpboot',
'tftp_dirs' => [
'/var/lib/tftpboot/pxelinux.cfg',
'/var/lib/tftpboot/grub',
'/var/lib/tftpboot/grub2',
'/var/lib/tftpboot/boot',
'/var/lib/tftpboot/ztp.cfg',
'/var/lib/tftpboot/poap.cfg',
],
},
}
end

it 'adds host-config to tftp_dirs' do
expect(migrated_answers['foreman_proxy']['tftp_dirs']).to include '/var/lib/tftpboot/host-config'
end
end

context 'tftp_dirs empty' do
let(:answers) do
{
'foreman_proxy' => {
'tftp_root' => '/var/lib/tftpboot',
'tftp_dirs' => nil,
},
}
end

it 'keeps tftp_dirs unchanged' do
expect(migrated_answers['foreman_proxy']['tftp_dirs']).to eq answers['foreman_proxy']['tftp_dirs']
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require 'spec_helper'

migration '20240531091300_foreman_proxy_tftp_bootloader_universe' do
scenarios %w[foreman katello foreman-proxy-content] do
context 'bootloader-universe in tftp_dirs missing' do
let(:answers) do
{
'foreman_proxy' => {
'tftp_root' => '/var/lib/tftpboot',
'tftp_dirs' => [
'/var/lib/tftpboot/pxelinux.cfg',
'/var/lib/tftpboot/grub',
'/var/lib/tftpboot/grub2',
'/var/lib/tftpboot/boot',
'/var/lib/tftpboot/ztp.cfg',
'/var/lib/tftpboot/poap.cfg',
],
},
}
end

it 'adds bootloader-universe/pxegrub2 to tftp_dirs' do
expect(migrated_answers['foreman_proxy']['tftp_dirs']).to include '/var/lib/tftpboot/bootloader-universe/pxegrub2'
end
end

context 'tftp_dirs empty' do
let(:answers) do
{
'foreman_proxy' => {
'tftp_root' => '/var/lib/tftpboot',
'tftp_dirs' => nil,
},
}
end

it 'keeps tftp_dirs unchanged' do
expect(migrated_answers['foreman_proxy']['tftp_dirs']).to eq answers['foreman_proxy']['tftp_dirs']
end
end
end
end

0 comments on commit f1b99e6

Please sign in to comment.