-
Notifications
You must be signed in to change notification settings - Fork 136
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
Conversation
A migration spec for this would be great to have. Example: https://github.com/theforeman/foreman-installer/blob/develop/spec/migrations/20240328125552_reset_puppetserver_ciphers_spec.rb |
c3e3495
to
f115512
Compare
FYI: @nofaralfasi and I had a discussion last week that resulted in some changes we want to implement on the Smart Proxy side which are summarized in the Smart Proxy PR. These changes also will affect this PR. Further updates will follow soonish / in the upcoming weeks (as soon as I have time to work on this again). |
One outcome of the above mentioned discussion was that the Bootloader Universe should not be configurable. Instead it will be a fixed folder inside the TFTP root that is created automatically during installation / upgrade. The other agreement was, that the Host Config directory will be written with a dash. Both have now been applied to this PR. |
/packit build |
Account nofaralfasi has no write access nor is author of PR! |
/packit build |
I think this will need a rebase to pass tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there multiple migrations, one adding host-config
and another adding bootloader-universe
?
There is no specific reason for that despite that the directories are independent of each other from a file system POV and that at the point I added the migration for the My current POV: We sould merge the migrations into one. What do you think about it @nofaralfasi? |
I also think that we should merge them into one. |
Hi, when testing this PR, we're getting the following error: |
Hey Nofar, that is strange... I do not encounter this error (or any other errors) on my test system I just rolled out. But I have to mention that my test setup is based on Foreman 3.11 with the changes from the Secure Boot PRs applied on top. |
When we run the
|
Thanks for the log! I assume the error is not related to the changes in the PR. But I do not know what is causing the error... :/ |
@nofar Rebased as discussed in DM. Maybe this solves the errors you encounter :) |
I squashed the migrations as discussed :) |
theforeman/smart-proxy#877 and theforeman/foreman#9864 have been merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go once we merge theforeman/puppet-foreman_proxy#821
theforeman/puppet-foreman_proxy#821 has been merged. Could we have this included as well? |
@@ -0,0 +1,10 @@ | |||
if answers['foreman_proxy'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always like to think about the data types and this is a Variant[Boolean, Hash]
. In other words, this can be true
as well and cause the later code to crash. true
means use all defaults and you don't need a migration. That's why most migrations use .is_a?(Hash)
if answers['foreman_proxy'] | |
if answers['foreman_proxy'].is_a?(Hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
root = answers['foreman_proxy']['tftp_root'] | ||
if answers['foreman_proxy']['tftp_dirs'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can fail because the data type of tftp_root
is Optional[Stdlib::Absolutepath]
(https://github.com/theforeman/puppet-foreman_proxy/blob/b73685cebc4efad1c23844843c0f98e1e6454138/manifests/init.pp#L340). It's usually set and I think it's safe enough to not migrate if it's not set.
root = answers['foreman_proxy']['tftp_root'] | |
if answers['foreman_proxy']['tftp_dirs'] | |
root = answers['foreman_proxy']['tftp_root'] | |
if root && answers['foreman_proxy']['tftp_dirs'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And done. Thanks @ekohl!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't explicitly say it, but please keep all migrations the same.
🙈 Is there a face palm emoji on GitHub? 😅 Fixed it |
Thanks a lot @ekohl for merging this! And thanks to everyone who was involved in getting this done 🎉 |
The migration is necessary as part of the puppet_foreman_proxy change in theforeman/puppet-foreman_proxy#821
Belongs to the SecureBoot story: theforeman/foreman#9864