The capsule sync task fails with error bad argument (expected URI object or URI string) after upgrading to Red Hat Satellite 6.10

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.10
  • Red Hat Capsule 6.10

Issue

  • After upgrading the Red Hat Satellite and Capsule servers to version 6.10, the capsule sync tasks are repeatedly failing with the following error.

    bad argument (expected URI object or URI string) (ArgumentError)
    

Resolution

  • The issue has been solved in Satellite 6.10.2 Async Bug Fix Update via RHSA-2022:0190.

  • Is strongly suggested to update the latest Satellite 6.10 bug fix update in order to benefit this and other bugfixes. If you're unable to update yet, please open up a This content is not included.support case with Red Hat to get an official hotfix or manual patch instructions to mitigate this problem.

  • Without using any hotfix or patch also, this issue can be worked around by taking this three-step approach as mentioned below:

    • Identify the repository in the Red Hat Satellite server that has no Upstream URL set, and set a fake http URL for that repository.

    • If the repository was a part of any content-view, then republish a new version of the same followed by promotion of lifecycle-environments on the newer version.

    • Attempt to perform an Optimized Sync for the affected Red Hat Capsule 6.10 server.

For more KB articles/solutions related to Red Hat Satellite 6.x Capsule Sync Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Capsule Sync Issues

Root Cause

  • Please refer to the This content is not included.description section of the Bugzilla to understand the root cause of this issue in detail.

  • This error will be visible during Capsule sync only if there is a repository present in the Satellite database without any Upstream or Feed URL.

Diagnostic Steps

  • Following errors are observed in the /var/log/foreman/production.log of the Satellite server during the attempt to synchronize the Capsule server.

       2021-11-30T15:58:47 [I|app|75d843b7] Processing by ForemanTasks::Api::TasksController#bulk_search as HTML
       2021-11-30T15:58:47 [I|app|75d843b7]   Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"ef616e71-0791-44c7-a5ce-1b747ecb2cc6", "search_id"=>"1"}], "task"=>{}}
       2021-11-30T15:58:48 [I|app|75d843b7] Completed 200 OK in 45ms (Views: 0.4ms | ActiveRecord: 3.0ms | Allocations: 63749)
    
       2021-11-30T15:58:48 [E|bac|   aa21db39] bad argument (expected URI object or URI string) (ArgumentError)
        aa21db39 | /opt/rh/rh-ruby27/root/usr/share/ruby/uri/common.rb:739:in `URI'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository/yum.rb:15:in `remote_options'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository.rb:197:in `compute_remote_options'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:37:in `needs_updates?'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository.rb:167:in `mirror_needs_updates?'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/lib/actions/katello/capsule_content/refresh_repos.rb:43:in `block in invoke_external_task'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in `each'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/lib/actions/katello/capsule_content/refresh_repos.rb:37:in `invoke_external_task'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/polling.rb:84:in `initiate_external_action'
    
       2021-11-30T15:58:49 [E|bac|   aa21db39] Missing the required parameter 'rpm_rpm_repository_href' when calling RepositoriesRpmApi.sync (ArgumentError)
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.13.3/lib/pulp_rpm_client/api/repositories_rpm_api.rb:468:in `sync_with_http_info'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.13.3/lib/pulp_rpm_client/api/repositories_rpm_api.rb:452:in `sync'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:123:in `sync'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/lib/actions/pulp3/capsule_content/sync.rb:18:in `invoke_external_task''
     
       2021-11-30T15:58:53 [E|bac|   aa21db39] undefined method `pulp_href' for nil:NilClass (NoMethodError)
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:78:in `publication_href'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:164:in `refresh_distributions'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb:17:in `invoke_external_task'
    
       2021-11-30T16:07:54 [E|bac|   aa21db39] undefined method `latest_version_href' for nil:NilClass (NoMethodError)
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:74:in `version_href'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:78:in `publication_href'
        aa21db39 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:164:in `refresh_distributions'
    
  • Following repositories were identified from the Satellite database, having no upstream URL set.

    # su - postgres -c "psql foreman -c \"select id, name, url, download_policy from katello_root_repositories where url is NULL;\""
     id |     name       | url | download_policy 
    ----+---------------+-----+-----------------
     51 |  iaas-rhel7    |     | immediate
    (1 row)
    
SBR
Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.