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 committed May 31, 2024
1 parent 7e79a3b commit c3e3495
Show file tree
Hide file tree
Showing 4 changed files with 66 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}/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}/host_config"
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' => [],
},
}
end

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

0 comments on commit c3e3495

Please sign in to comment.