-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #36940 - Add necessary migration for host_config tftp directory
- Loading branch information
Showing
8 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
config/foreman-proxy-content.migrations/240531091300_foreman_proxy_tftp_host_config.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
...g/foreman-proxy-content.migrations/240805150500_foreman_proxy_tftp_bootloader_universe.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
config/foreman.migrations/20240531091300_foreman_proxy_tftp_host_config.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
config/foreman.migrations/20240805150555_foreman_proxy_tftp_bootloader_universe.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
config/katello.migrations/240531091300_foreman_proxy_tftp_host_config.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
config/katello.migrations/240805150500_foreman_proxy_tftp_bootloader_universe.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
42 changes: 42 additions & 0 deletions
42
spec/migrations/20240531091300_foreman_proxy_tftp_host_config_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
42 changes: 42 additions & 0 deletions
42
spec/migrations/20240805150500_foreman_proxy_tftp_bootloader_universe.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |