Katello 4.9 Custom products changes with SCA

After double-checking in Foreman’s code, I think this should be fine.

Upgrade tasks are executed during rake upgrade:run: foreman/lib/tasks/upgrade.rake at ba1abfc447fd22447c79d7351d39507cba4b8b83 · theforeman/foreman · GitHub

The only upgrade tasks that execute are those “needing run”:

UpgradeTask.needing_run

and then when the task completes successfully, it marks them as ran:

task.mark_as_ran! if run_task(task)

What this means is that a given upgrade rake task should only run once, regardless of version namespacing-- unless you clear out your database or something, or the task is marked as :always_run (which this one isn’t.) So, for upgrades, we should be all good.

However, I tested in the console on a new install:

irb(main):003:0> UpgradeTask.find_by(name: "katello:upgrades:4.9:update_custom_products_enablement").last_run_time
=> nil

This may mean there’s an issue in the following scenario:

  1. I perform a new install of Katello 4.9.0. The upgrade tasks never run, since it’s a new install. Default product enablement is disabled.
  2. I then upgrade to 4.9.1 or 4.10. The upgrade task’s last_run_time is nil, so it will be included in UpgradeTask.needing_run and create enabled overrides for all my custom repositories.

I’ve created Bug #36540: Upgrade rake task will create bad content overrides on post-4.9 Katello upgrades - Katello - Foreman

thanks for helping me think this out!

3 Likes