Tracker #29746: Merge hooks/ and katello/hooks into a single directory structure
Move --lock-package-versions to hooks/
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
There helper itself is split into two methods. The one with bang exits
on failure while the one without only returns the status.
#4 Updated by Ewoud Kohl van Wijngaarden about 1 year ago
- Status changed from Ready For Testing to Closed
Applied in changeset installer|5d22a4c38630c6ff090c32e0926cbd5b0f32f74c.