Refactor #29798

Tracker #29746: Merge hooks/ and katello/hooks into a single directory structure

Move --lock-package-versions to hooks/

Added by Eric Helms over 1 year ago. Updated 10 months ago.

foreman-installer script
Target version:
Bugzilla link:

Associated revisions

Revision 5d22a4c3 (diff)
Added by Ewoud Kohl van Wijngaarden about 1 year ago

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.


#1 Updated by The Foreman Bot over 1 year ago

  • Assignee set to William Clark
  • Status changed from New to Ready For Testing
  • Pull request added

#2 Updated by The Foreman Bot about 1 year ago

  • Pull request added

#3 Updated by The Foreman Bot about 1 year ago

  • Fixed in Releases 2.3.0 added

#4 Updated by Ewoud Kohl van Wijngaarden about 1 year ago

  • Status changed from Ready For Testing to Closed

#5 Updated by Ewoud Kohl van Wijngaarden 10 months 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

Also available in: Atom PDF