Bug 1446727

Summary: Repair repositories fail with 400 bad request in satellite 6.2
Product: Red Hat Satellite Reporter: Satellite Program <pm-sat>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Radovan Drazny <rdrazny>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: akarsale, aupadhye, bbuckingham, bkearney, jcallaha, jentrena, jsherril, mmccune, phess, pmoravec, rdrazny, vijsingh
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1375075 Environment:
Last Closed: 2018-02-21 16:45:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1425437, 1446729    

Comment 2 Radovan Drazny 2017-10-10 14:00:23 UTC
Tested on Satellite 6.3 Snap 19. There was a showstopper right in the start - the "/usr/share/foreman/lib/tasks/repair_repos.rake" is missing in the Sat6.3 Snap 19. 

I have used "http://people.redhat.com/~mmccune/repair_repos_62.rake" mentioned in "https://access.redhat.com/solutions/1453313". I have tried "http://people.redhat.com/~mmccune/repair_repos.rake"

  - Run "foreman-rake katello:generate_repositories_to_fix"
  - Run "foreman-rake katello:generate_pulp_repositories"

Results for repair_repos.rake:

$ foreman-rake katello:generate_pulp_repositories
Unable to fix repository with the pulp_id '0379d32a-fb66-4a56-bdd4-c96a6321f8c7'. Error => [400 Bad Request]
["/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/abstract_response.rb:74:in `return!'", "/opt/theforeman/tfm/root/usr/share/gems/gems/runcible-1.12.0/lib/runcible/base.rb:79:in `block in get_response'", "/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:493:in `process_result'", "/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:421:in `block in transmit'", "/opt/rh/rh-ruby23/root/usr/share/ruby/net/http.rb:853:in `start'", "/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:413:in `transmit'", "/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in `execute'", "/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in `execute'", "/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/resource.rb:67:in `post'", "/opt/theforeman/tfm/root/usr/share/gems/gems/runcible-1.12.0/lib/runcible/base.rb:78:in `get_response'", "/opt/theforeman/tfm/root/usr/share/gems/gems/runcible-1.12.0/lib/runcible/base.rb:66:in `call'", "/opt/theforeman/tfm/root/usr/share/gems/gems/runcible-1.12.0/lib/runcible/resources/repository.rb:22:in `create'", "/opt/theforeman/tfm/root/usr/share/gems/gems/runcible-1.12.0/lib/runcible/extensions/repository.rb:69:in `create_with_importer_and_distributors'", "/usr/share/foreman/lib/tasks/repair_repos.rake:48:in `run'", "/usr/share/foreman/lib/tasks/repair_repos.rake:148:in `fix_repo'", "/usr/share/foreman/lib/tasks/repair_repos.rake:163:in `block (3 levels) in <top (required)>'", "/usr/share/foreman/lib/tasks/repair_repos.rake:161:in `each'", "/usr/share/foreman/lib/tasks/repair_repos.rake:161:in `block (2 levels) in <top (required)>'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'", "/opt/rh/rh-ruby23/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'", "/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'", "/opt/rh/rh-ruby23/root/usr/bin/rake:23:in `load'", "/opt/rh/rh-ruby23/root/usr/bin/rake:23:in `<main>'"]
Unable to fix repository with the pulp_id '15317193-2638-43ea-a735-b4d687a3ac8d'. Error => [400 Bad Request]
<...>

Results for repair_repos_62.rake:

$ foreman-rake katello:generate_pulp_repositories
<...>
Completed generating pulp repo for the following repository

       name: Centos 7 repo
       pulp_id: b41297ef-c575-4934-8daa-d6df8ccdd488
       product: Centos 7
       organization: Default Organization

You need to manually sync this repository in the specified organization before proceeding.
Completed generating pulp repo for the following repository

       name: Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.3
       pulp_id: cf825035-8ace-4bbf-ba48-c4f92378b193
       product: Red Hat Enterprise Linux Server
       organization: Default Organization

You need to manually sync this repository in the specified organization before proceeding.
Completed generating pulp repo for the following repository

       name: Red Hat Enterprise Linux 6 for System Z RPMs s390x 6.9
       pulp_id: dae926a3-e493-4909-b604-fc1a82b70692
       product: Red Hat Enterprise Linux for IBM z Systems
       organization: Default Organization

You need to manually sync this repository in the specified organization before proceeding.


The old "repair_repos.rake" generates the "[400 Bad Request]" errors, no repos were fixed.
The new (I suppose) "repair_repos_62.rake" successfully generates repos.
Still, the main problem is that "repair_repos_62.rake" is missing in the compose.

Comment 3 Satellite Program 2017-10-10 16:24:24 UTC
Upstream bug assigned to jsherril

Comment 10 Radovan Drazny 2017-10-25 12:11:54 UTC
Ok, my fault - I went by the initial report talking about "katello:generate_pulp_repositories", found out there is no such task, searched for it, found https://access.redhat.com/solutions/1453313 and assumed there was a problem with Sat 6.3. Should have go deeper in the original BZ1375075, as I have missed the comment 11 there. Sorry about that.

Going through steps from BZ1375075 comment #11 on Sat 6.3 Snap 21:

$ foreman-rake console
Loading production environment (Rails 4.2.6)
Failed to load console gems, starting anyway
irb(main):001:0> Katello.pulp_server.resources.repository.delete(Katello::Repository.find(4).pulp_id)
=> {"spawned_tasks"=>[{"_href"=>"/pulp/api/v2/tasks/85934af6-f99a-466e-9d07-b1e76bcc50b9/", "task_id"=>"85934af6-f99a-466e-9d07-b1e76bcc50b9"}], "result"=>nil, "error"=>nil}
irb(main):002:0> 

$ COMMIT=true foreman-rake katello:correct_repositories
Processing Repository 1/2: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server (1)
Processing Repository 2/2: Satellite Tools 6.3 repo (4)
Repository 4 Missing
Recreating 4

$ foreman-rake katello:regenerate_repo_metadata
Regenerating 2 repositories.  You can monitor these on task id b895a75d-b57b-4579-9be8-36cff5d384b7
$ foreman-rake katello:refresh_pulp_repo_details

Refreshing 2 repositories.  You can monitor these on task id 8589af33-022b-4c99-a6a4-070560900f58

Tasks for katello:regenerate_repo_metadata and katello:refresh_pulp_repo_details both passed successfully.

Comment 11 Bryan Kearney 2018-02-21 16:41:44 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336

Comment 12 Bryan Kearney 2018-02-21 16:45:20 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336