Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36940 - Add necessary migration for host_config tftp directory #949

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if answers['foreman_proxy'].is_a?(Hash)
root = answers['foreman_proxy']['tftp_root']
if root && answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/bootloader-universe"
dirs << "#{root}/bootloader-universe/pxegrub2"
dirs << "#{root}/host-config"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if answers['foreman_proxy'].is_a?(Hash)
root = answers['foreman_proxy']['tftp_root']
if root && answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/bootloader-universe"
dirs << "#{root}/bootloader-universe/pxegrub2"
dirs << "#{root}/host-config"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if answers['foreman_proxy'].is_a?(Hash)
root = answers['foreman_proxy']['tftp_root']
if root && answers['foreman_proxy']['tftp_dirs']
dirs = answers['foreman_proxy']['tftp_dirs']
dirs << "#{root}/bootloader-universe"
dirs << "#{root}/bootloader-universe/pxegrub2"
dirs << "#{root}/host-config"
dirs.uniq!
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 bootloader-universe to tftp_dirs' do
expect(migrated_answers['foreman_proxy']['tftp_dirs']).to include '/var/lib/tftpboot/bootloader-universe'
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

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