Project

General

Profile

Actions

Bug #33966

closed

Capsule sync task failed to refresh repo that doesn't have feed url

Added by Hao Yu over 2 years ago. Updated about 2 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Description of problem:

There are 2 issues here:
1) The "needs_updates?" will always be "true" so Satellite will always try to refresh the repos in the Capsule.
2) Capsule sync task failed to refresh custom repository without feed url:
---------------------------------------------
5: Actions::Pulp3::Orchestration::Repository::RefreshRepos (skipped) [ 6.90s / 6.41s ]

Error:

ArgumentError

bad argument (expected URI object or URI string)
---
- "/opt/rh/rh-ruby27/root/usr/share/ruby/uri/common.rb:739:in `URI'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository/yum.rb:15:in
`remote_options'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository.rb:197:in
`compute_remote_options'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:37:in
`needs_updates?'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository.rb:167:in
`mirror_needs_updates?'"
- "/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'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in
`each'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in
`each'"
--------------------------------------------

Below should be the offending lines

In /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb
def needs_updates?
remote = fetch_remote
return true if remote.blank?
options = repo_service.compute_remote_options <=============== It seems like "self.remote_options" should be used here
options.keys.any? { |key| remote.send(key) != options[key] }
end

In "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository/yum.rb",

def remote_options
options = common_remote_options
uri = URI(root.url) <========================== This will gives error if root repo has no feed.
unless root.upstream_authentication_token.blank?
options.merge!(sles_auth_token: root.upstream_authentication_token)
end
options.merge!(url: uri.to_s, policy: root.download_policy)
end

Steps to Reproduce:
1. Create a custom repo without feed and manually upload content to it.
2. Create a CV add the custom repo to the CV.
3. Publish and Promote the CV which should trigger a capsule sync task.
4. The capsule sync task should finish without error.
5. Upload new content to the custom repo.
6. Publush and Promote the CV again.

Actual results:
Capsule sync task failed to refresh repos with "bad argument (expected URI object or URI string)" error.

Expected results:
No error. Only refresh repos as needed


Related issues 1 (0 open1 closed)

Is duplicate of Katello - Bug #33893: smart proxy syncing a repository that has no upstream url set error with '"bad argument (expected URI object or URI string)'ClosedJustin SherrillActions
Actions #1

Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Hao Yu
  • Pull request https://github.com/Katello/katello/pull/9803 added
Actions #2

Updated by Ian Ballou over 2 years ago

  • Triaged changed from No to Yes
Actions #3

Updated by Justin Sherrill over 2 years ago

  • Is duplicate of Bug #33893: smart proxy syncing a repository that has no upstream url set error with '"bad argument (expected URI object or URI string)' added
Actions #4

Updated by Justin Sherrill over 2 years ago

  • Status changed from Ready For Testing to Closed
Actions #5

Updated by Ian Ballou about 2 years ago

  • Status changed from Closed to Duplicate
Actions #6

Updated by Ian Ballou about 2 years ago

  • Target version changed from Katello 4.4.0 to Katello Recycle Bin
Actions

Also available in: Atom PDF