Refactor #29798
Tracker #29746: Merge hooks/ and katello/hooks into a single directory structure
Move --lock-package-versions to hooks/
Status:
Closed
Priority:
Normal
Assignee:
Category:
foreman-installer script
Target version:
Difficulty:
Triaged:
Yes
Associated revisions
History
#1
Updated by The Foreman Bot almost 3 years ago
- Assignee set to William Clark
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman-installer/pull/511 added
#2
Updated by The Foreman Bot over 2 years ago
- Pull request https://github.com/theforeman/foreman-installer/pull/536 added
#3
Updated by The Foreman Bot over 2 years ago
- Fixed in Releases 2.3.0 added
#4
Updated by Ewoud Kohl van Wijngaarden over 2 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset installer|5d22a4c38630c6ff090c32e0926cbd5b0f32f74c.
#5
Updated by Ewoud Kohl van Wijngaarden over 2 years ago
- Triaged changed from No to Yes
- Target version set to 2.3.0
- Category set to foreman-installer script
- Tracker changed from Feature to Refactor
Fixes #29798 - Move --lock-package-versions to hooks/
The primary goal of this PR is to move the hook from Katello to a shared
one. An accidental move in 6e1a07bc35bfe97927dfac6477a1faf53092c58f
resulted on this being executed on Debian which showed some flaws.
Additional improvements are made to make it robust.
This uses the package_lock_feature? helper to determine whether locking
is available. It then uses the newly introduced app_option? to determine
if the option is available. This means it doesn't have to execute
package_lock_feature? within the pre_commit hook again which saves an
exec() of an external process.
In case locking could not be performed, the preference is cleared to
allow the user to proceed. This saves them from having to edit the
scenario manually. Instructions are printed to restore functionality.
This also reduces the size of ForemanMaintainHookContextExtension to
just the minimal wrapper. Methods that are only used once are moved into
their particular hook file. This makes it easier to understand a single
file.
There helper itself is split into two methods. The one with bang exits
on failure while the one without only returns the status.