Bug 1459845

Summary: Internal server error when removing packages from a repository
Product: Red Hat Satellite Reporter: Djebran Lezzoum <dlezzoum>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: John Mitsch <jomitsch>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbuckingham, ehelms, jomitsch
Target Milestone: UnspecifiedKeywords: Regression, 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: Environment:
Last Closed: 2018-02-21 16:54:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
when deleting a package from repository none

Description Djebran Lezzoum 2017-06-08 10:45:10 UTC
Created attachment 1286103 [details]
foreman debug output

Description of problem:
Internal server error when removing packages from a repository

Version-Release number of selected component (if applicable):
* candlepin-2.0.35-1.el7.noarch
* candlepin-selinux-2.0.35-1.el7.noarch
* foreman-1.15.0-1.el7sat.noarch
* foreman-cli-1.15.0-1.el7sat.noarch
* foreman-compute-1.15.0-1.el7sat.noarch
* foreman-debug-1.15.0-1.el7sat.noarch
* foreman-discovery-image-3.1.1-22.el7sat.noarch
* foreman-ec2-1.15.0-1.el7sat.noarch
* foreman-gce-1.15.0-1.el7sat.noarch
* foreman-installer-1.15.0-1.el7sat.noarch
* foreman-installer-katello-3.4.0.1-1.el7sat.noarch
* foreman-libvirt-1.15.0-1.el7sat.noarch
* foreman-openstack-1.15.0-1.el7sat.noarch
* foreman-ovirt-1.15.0-1.el7sat.noarch
* foreman-postgresql-1.15.0-1.el7sat.noarch
* foreman-proxy-1.15.0-2.el7sat.noarch
* foreman-rackspace-1.15.0-1.el7sat.noarch
* foreman-selinux-1.15.0-1.el7sat.noarch
* foreman-vmware-1.15.0-1.el7sat.noarch
* katello-3.4.0-3.el7sat.noarch
* katello-ca-consumer-sat-r220-02.lab.eng.rdu2.redhat.com-1.0-1.noarch
* katello-certs-tools-2.4.0-1.el7sat.noarch
* katello-client-bootstrap-1.3.0-1.el7sat.noarch
* katello-common-3.4.0-3.el7sat.noarch
* katello-debug-3.4.0-3.el7sat.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-base-3.4.0.1-1.el7sat.noarch
* katello-selinux-3.0.2-1.el7sat.noarch
* katello-server-ca-1.0-1.noarch
* katello-service-3.4.0-3.el7sat.noarch
* openldap-2.4.40-13.el7.x86_64
* pulp-client-1.0-1.noarch
* pulp-docker-plugins-2.3.0-1.el7sat.noarch
* pulp-katello-1.0.2-1.el7sat.noarch
* pulp-ostree-plugins-1.2.1-1.el7sat.noarch
* pulp-puppet-plugins-2.12.2-1.el7sat.noarch
* pulp-puppet-tools-2.12.2-1.el7sat.noarch
* pulp-rpm-plugins-2.12.2-1.el7sat.noarch
* pulp-selinux-2.12.2-1.el7sat.noarch
* pulp-server-2.12.2-1.el7sat.noarch
* python-ldap-2.4.15-2.el7.x86_64
* tfm-rubygem-ldap_fluff-0.4.6-1.el7sat.noarch
* tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch


How reproducible:
Always

Steps to Reproduce:
1. goto products create a product
2.select the created product  
3.create a repository for example 
4. synchronize the created reposity
5. select the created repository
6. select Content Type> Packages (click on the number of packages)
7. select some packages and click delete

Actual results:
no response, all the packages are disabled and the delete button also.
in the production log we can notice the server internal error


Expected results:
the packages deleted successfully response


Additional info:
Note when same procedure is done via API: the result is:
Received HTTP 500 response: {"displayMessage":"Task 6c8223c7-8734-4e82-9e31-7d958f3255fe: ActiveRecord::RecordNotFound: Couldn't find Katello::Repository with 'id'=","errors":["Task 6c8223c7-8734-4e82-9e31-7d958f3255fe: ActiveRecord::RecordNotFound: Couldn't find Katello::Repository with 'id'="]}
 
in any of the cases the packages are deleted, but no response in UI, HTTP 500 under API

Comment 2 Djebran Lezzoum 2017-06-08 10:52:27 UTC
Created attachment 1286105 [details]
when deleting a package from repository

Comment 3 Djebran Lezzoum 2017-06-08 11:09:02 UTC
under hammer this reproducible with: 

hammer repository remove-content --id="239" --ids="19,18"

500 Internal Server Error
Task beac9093-153d-430a-984e-640c0ce11912: ActiveRecord::RecordNotFound: Couldn't find Katello::Repository with 'id'=
Could not remove content:
  Task beac9093-153d-430a-984e-640c0ce11912: ActiveRecord::RecordNotFound: Couldn't find Katello::Repository with 'id'=

RestClient::InternalServerError (500 Internal Server Error):
    /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/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:334:in `block in rest_client_call_block'
    /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:76:in `put'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:313:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:229:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:179:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:174:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.0/lib/hammer_cli_foreman/commands.rb:158:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/bin/hammer:146:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 5 Samir Jha 2017-06-14 19:29:17 UTC
Created redmine issue http://projects.theforeman.org/issues/20023 from this bug

Comment 6 Satellite Program 2017-06-19 14:09:10 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20023 has been resolved.

Comment 7 John Mitsch 2017-08-02 17:49:28 UTC
Verified in 6.3.0 snap 9

I was able to remove packages from a repository in the UI and using hammer

[root@sat63qedev ~]# hammer repository remove-content --id=1 --ids='29,2'
Repository content removed

Comment 9 Satellite Program 2018-02-21 16:54:17 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