Foreman Centos 7 Repository Out of Sync

I have four CentOS 7 repositories setup in Foreman which have been working as expected for a couple of years. Recently I notice the repo for CentOS 7 Updates which is synced to CentOS Mirror is having an odd issue. When I go to Products → “Name” → Repositories → “Name” → CentOS 7 Updates → Packages I can tell that it is missing the latest versions of a bunch of packages. For example for open-vm-tools the latest version it has is 9.4 it is missing 9.6 and 9.7. From what I can tell it is missing the versions from the last 3-4 months. When I check the actual published repo on the foreman server I can see these missing later versions are here. So it appears the Foreman server has correctly synced the repo to itself its just the web portal that is not correctly reflecting this.

In the Foreman web portal for the CentOS 7 Updates it has a package count of 5053 when I checked the package count of the actual repo for CentOS 7 Updates on the Foreman server it has a package count of
5,367. The other 3 repos that I have seem to be fine and the counts all match between the Foreman web portal and the Foreman repo.

I have tried Republishing Repository Metadata and verify the content checksums but neither seems to help. Foreman is on version 2.4.1 and Katello is on 4.0.1.

Any idea on what can be done to fix this?

The effect you are describing sounds like there was a Sync task which completed all of its actions except Actions::Pulp3::Repository::SaveVersion successfully. If that is the case a re-publish repository metadata would not help, since that repeats the Actions::Pulp3::Repository::CreatePublication action.

My expectation would be that this situation is “self healing” the next time a sync of the repo in question actually adds some new content to the repo, but I am not certain about that.

If you navigate to “Monitor > Tasks” in the UI, you could try searching/filtering for something like “Synchronize repository <your_centos_7_repository_name_here>” to list all sync tasks for the repo in question. Do any of them not show success in the Result column?

If you open an individual task, you can click the “Dynflow console” button to open a different task view that lists each action that the task performed. If I am right, one of those should show at least the Actions::Pulp3::Repository::SaveVersion action in yellow (or at least not green). While most other actions are green.

I am not sure there is a way to force a repeat of just that one action, the way there is for “republish repository metadata”. Does a complete sync help? (Its possible that a sync that does not add any new packages because the upstream has not changed will simply skip the action we want).

What you are describing is a bit similar in nature to Bug #36859: A re-sync should always recover from a previous syncs failed publication - Katello - Foreman albeit affecting a different action.

I am going to ping @iballou to see if he knows if there might be a rake task to fix this exact situation?

Thanks for pointing me to the dynflows. Looking at them and most of them complete in a few seconds and all parts of the run show as a success. I did notice that every couple of weeks there will be one that takes like 5-10 minutes where it looks like it trying to get updated packages. These ones all have a warning. If I look at the step you mentioned “Actions::Pulp3::Repository::SaveVersion” that will show as a success and looks to show the correct number of packages in the repo 5,367. Where it looks to be having issues is this step “Actions::Katello::Repository::IndexContent (skipped) [ 35.99s / 34.04s ]”
That step is erroring out.

Queue: default

Started at: 2023-10-21 11:07:06 UTC

Ended at: 2023-10-21 11:07:41 UTC

Real time: 35.99s

Execution time (excluding suspended state): 34.04s

Input:


id: 8
contents_changed: true
current_request_id: a0229f9d-2ade-4fa6-85b4-c80bcac8e823
current_timezone: America/Los_Angeles
current_organization_id: 1
current_location_id: 2
current_user_id: 1
Output:

— {}
Error:

PulpRpmClient::ApiError

Error message: the server returns an error HTTP status code: 502 Response headers: {“date”=>“Sat, 21 Oct 2023 11:07:07 GMT”, “server”=>“Apache”, “content-length”=>“445”, “connection”=>“close”, “content-type”=>“text/html; charset=iso-8859-1”} Response body: 502 Proxy Error

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /pulp/api/v3/content/rpm/packages/.

Reason: Error reading from remote server


  • “/opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.10.0/lib/pulp_rpm_client/api_client.rb:81:in
    `call_api’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.10.0/lib/pulp_rpm_client/api/content_packages_api.rb:244:in
    `list_with_http_info’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.10.0/lib/pulp_rpm_client/api/content_packages_api.rb:130:in
    `list’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/services/katello/pulp3/pulp_content_unit.rb:93:in
    `content_unit_list’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/services/katello/pulp3/pulp_content_unit.rb:106:in
    `fetch_content_list’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/services/katello/pulp3/pulp_content_unit.rb:75:in
    `block (2 levels) in pulp_units_batch_for_repo’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/services/katello/pulp3/pulp_content_unit.rb:69:in
    `loop’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/services/katello/pulp3/pulp_content_unit.rb:69:in
    `block in pulp_units_batch_for_repo’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/concerns/pulp_database_unit.rb:120:in
    `each’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/concerns/pulp_database_unit.rb:120:in
    `each’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/concerns/pulp_database_unit.rb:120:in
    `import_for_repository’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/repository.rb:902:in
    `block (2 levels) in index_content’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/lib/katello/logging.rb:6:in
    `time’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/repository.rb:901:in
    `block in index_content’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/repository.rb:900:in
    `each’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/models/katello/repository.rb:900:in
    `index_content’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/lib/actions/katello/repository/index_content.rb:18:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:571:in
    `block (3 levels) in execute_run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.1.2/app/lib/actions/middleware/execute_if_contents_changed.rb:5:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/rails_executor_wrap.rb:14:in
    `block in run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/execution_wrapper.rb:88:in
    `wrap’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/rails_executor_wrap.rb:13:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action/progress.rb:31:in
    `with_progress_calculation’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action/progress.rb:17:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_request_id.rb:15:in
    `block in run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_request_id.rb:52:in
    `restore_current_request_id’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_request_id.rb:15:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_timezone.rb:15:in
    `block in run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_timezone.rb:44:in
    `restore_curent_timezone’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_timezone.rb:15:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_taxonomies.rb:15:in
    `block in run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_taxonomies.rb:45:in
    `restore_current_taxonomies’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_taxonomies.rb:15:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:32:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:27:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware.rb:19:in
    `pass’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_user.rb:15:in
    `block in run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_user.rb:54:in
    `restore_curent_user’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.0.1/app/lib/actions/middleware/keep_current_user.rb:15:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/stack.rb:23:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/middleware/world.rb:31:in
    `execute’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:570:in
    `block (2 levels) in execute_run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:569:in
    `catch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:569:in
    `block in execute_run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:472:in
    `block in with_error_handling’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:472:in
    `catch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:472:in
    `with_error_handling’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:564:in
    `execute_run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/action.rb:285:in
    `execute’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:18:in
    `block (2 levels) in execute’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/execution_plan/steps/abstract.rb:167:in
    `with_meta_calculation’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:17:in
    `block in execute’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:32:in
    `open_action’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:16:in
    `execute’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/director.rb:68:in
    `execute’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/executors/sidekiq/worker_jobs.rb:11:in
    `block (2 levels) in perform’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/executors.rb:18:in
    `run_user_code’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/executors/sidekiq/worker_jobs.rb:9:in
    `block in perform’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/executors/sidekiq/worker_jobs.rb:25:in
    `with_telemetry’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/executors/sidekiq/worker_jobs.rb:8:in
    `perform’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.8/lib/dynflow/executors/sidekiq/serialization.rb:27:in
    `perform’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:192:in
    `execute_job’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:165:in
    `block (2 levels) in process’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/middleware/chain.rb:128:in
    `block in invoke’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/middleware/chain.rb:133:in
    `invoke’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:164:in
    `block in process’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:137:in
    `block (6 levels) in dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/job_retry.rb:109:in
    `local’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:136:in
    `block (5 levels) in dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq.rb:37:in
    `block in module:Sidekiq’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:132:in
    `block (4 levels) in dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:250:in
    `stats’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:127:in
    `block (3 levels) in dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/job_logger.rb:8:in
    `call’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:126:in
    `block (2 levels) in dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/job_retry.rb:74:in
    `global’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:125:in
    `block in dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/logging.rb:48:in
    `with_context’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/logging.rb:42:in
    `with_job_hash_context’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:124:in
    `dispatch’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:163:in
    `process’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:83:in
    `process_one’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/processor.rb:71:in
    `run’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/util.rb:16:in
    `watchdog’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/sidekiq-5.2.7/lib/sidekiq/util.rb:25:in
    `block in safe_thread’”
  • “/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in
    `block in create_with_logging_context’”

Googling my error message I was able to come across someone with a similar issue and a solution. I needed to set the bulk_load_size to 500 in my /etc/foreman/plugins/katello.yaml for the pulp setting. Unlike the examples I found my katello.yaml did not actually have a pulp section at all so I added that in with the settings like this

:pulp:
:bulk_load_size: 500

Restarted the server and then did a complete sync of the repo and it was successful and now correctly shows the 5,367 packages.

1 Like